[Posting] Re: Rob Failed
From:James T. Plagerism
Thread:Rob Failed
Forum:Bugs
In reply to:Re: Rob Failed
Date:Sun, 2020-06-28 21:40 GMT

I have read somewhere there is a 1% default chance of failing the rob.

Yes, that's not in question (the default RobFailureOdds is 1).
What is in question is why I'm getting messages about a failed rob when there is (as far as I can tell, especially from how frequently I get this message) no enemy ship there to rob.

What it looks like to me is the logic is currently:

if (rand(0,100) < RobFailureOdds) then
  SendMessage("Rob Failed")
elseif (EnemyShipPresent) then
  RobEnemy()
end

But I think it should look like

if (EnemyShipPresent) then
  if (rand(0,100) < RobFailureOdds) then
    SendMessage("Rob Failed")
  else
    RobEnemy()
  end
end
This is a testing version.
It may be incomplete, and have more bugs (or features) than the public live version at planetscentral.com.