Posted: Sun Mar 09, 2008 1:44 am Post subject: mobile.opponent to return opponent even if just defending
I considered this is more a lack of feature than a bug.
Core-changes.txt, Austin wrote:
Added : Member for mobiles ".opponent". Returns a mobile reference if a combat opponent is selected.
If PC or NPC (through SetOpponent()) selects an opponent mobile.opponent works right like it is supposed to:
attacker's .opponent returns reference to chosen victim.
But, would be nice if the mobile that are attacked against (if is not attacking anyone), would get it's .opponent-member updated to return the reference of the attacker.
Currently (POL 097) this won't happen; defender.opponent is null.
The idea in other words: there are these mobiles A, B and C, all at ease.
1. A attacks B -> A.opponent returns B. Because B is not attacking no-one, B.opponent would return A.
2. C attacks B -> C.opponent would return B, but B.opponent stays the same (returning A).
3. B choses to attack C instead of defending against A -> B.opponent returns C.
4. C gives up (or dies) -> C.opponent returns null, B.opponent returns A (defending against), A.opponent returns B (attacking against).
...That should clear it up.
After this modification one would be able to tell easily the real opponent the mobile has. I can not think of any reason why this would be harmless (and thus bad thing to implement), but if there is one, please do tell.