mobile.opponent to return opponent even if just defending

Archive of the older Feature Request Forum Posts
Locked
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

mobile.opponent to return opponent even if just defending

Post by ncrsn »

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.
Locked