#75 allow multiple when clauses on TriggerAttachments

Unstable (example)
closed-accepted
Chris Duncan
None
5
2014-01-02
2013-09-25
David Landry
No

To reduce the number of changes to the tripleA code base, a lot of the rule functionality for 1914 was done through triggers.

For example, minefields are owned by the owner of the neighboring territory with a port.. So, when a territory with a port is taken over, the minefield needs to change ownership. This was done using triggers for each territory/port. The problem is that it needs to be checked at the end of every player's turn, which means 8 separate rules and triggers.

This change allows multiple when clauses to be added to a trigger, and the trigger is evaluated at each of those points. For example:

    <attatchment name="triggerAttachment_Remove_American_Minefield_in_United_States_of_America" attatchTo="Americans" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
        <option name="trigger" value="conditionAttachment_Minefield_United_States_of_America_Austrians:conditionAttachment_Minefield_United_States_of_America_Germans:conditionAttachment_Minefield_United_States_of_America_Ottomans"/>
        <option name="conditionType" value="OR"/>
        <option name="when" value="before:austrianEndTurn"/>
        <option name="when" value="before:russianEndTurn"/>
        <option name="when" value="before:germanEndTurn"/>
        <option name="when" value="before:frenchEndTurn"/>
        <option name="when" value="before:britishEndTurn"/>
        <option name="when" value="before:ottomanEndTurn"/>
        <option name="when" value="before:italianEndTurn"/>
        <option name="when" value="before:americanEndTurn"/>
        <option name="removeUnits" value="Sea Zone 1:minefield" count="1"/>
    </attatchment>
1 Attachments

Discussion

  • Chris Duncan
    Chris Duncan
    2014-01-02

    • status: open --> closed-accepted
    • assigned_to: Chris Duncan
     
  • Chris Duncan
    Chris Duncan
    2014-01-02

    accepted and committed