Content-Type: multipart/mixed; boundary=Apple-Mail-56-383032104 --Apple-Mail-56-383032104 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Hi = All,

I created a patch for turnbased tech activation, = with this you can automatically give certain techs to certain countries = on a certain turn. 

For example you can = give IndustrialTechnology to US at turn 4 to change its = productionfrontier, or give JetPower to the Germans at turn = 5.

Add a               =   

<delegate name=3D"turn_tech_activation" = javaClass=3D"games.strategy.triplea.delegate.TurnbasedTechActivatio= nDelegate" display=3D"Activate = Technology By Turn"/>

Add this step to a = power:

<step name=3D"britishTurnTechActivation" delegate=3D"turn_tech_activation" player=3D"British"/>

And add the property to set the = technology in the properties section:

<property = name=3D"Activate jetPower for British on turn" value=3D"4" editable=3D"true">
     <number min=3D"0" max=3D"1000"/>
</property>

The = propertyname is always "Activate xxx for xxx on turn" and the value is = the turn it should be added.

Would appreciate = the peer-review and inclusion of this patch.

(I have yet to = test if you can use this techActivation as well to allow access to = certain units at a later turn or at least make them affordable (20 for a = B29 instead of 50 for example) at a later turn, not sure if you can add = different IndustrialTechnology production frontiers for each = country.
<= span class=3D"Apple-style-span" style=3D"color: rgb(60, 53, 249); = font-family: Monaco; font-size: 11px; ">             =   
= --Apple-Mail-56-383032104 Content-Disposition: attachment; filename=TurnBasedTech.patch Content-Type: application/octet-stream; name="TurnBasedTech.patch" Content-Transfer-Encoding: 7bit ### Eclipse Workspace Patch 1.0 #P triplea Index: src/games/strategy/triplea/Properties.java =================================================================== --- src/games/strategy/triplea/Properties.java (revision 2702) +++ src/games/strategy/triplea/Properties.java (working copy) @@ -673,10 +673,13 @@ } } - - - - + public static int getActivateTechOnTurn(GameData data,String techName, String playerName) { + try { + return Integer.parseInt((String) data.getProperties().get("Activate "+techName+" for "+ playerName +" on turn")); + } catch (NumberFormatException e) { + return -1; + } + } private Properties() { } Index: src/games/strategy/triplea/delegate/TurnbasedTechActivationDelegate.java =================================================================== --- src/games/strategy/triplea/delegate/TurnbasedTechActivationDelegate.java (revision 0) +++ src/games/strategy/triplea/delegate/TurnbasedTechActivationDelegate.java (revision 0) @@ -0,0 +1,154 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * TurnBasedTechActivationDelegate.java + * + * Created on February 18th 2010 + */ + +package games.strategy.triplea.delegate; + +import games.strategy.engine.data.*; +import games.strategy.triplea.Properties; +import games.strategy.engine.delegate.*; +import games.strategy.engine.message.IRemote; + +import java.io.Serializable; +import java.util.*; + +/** + * Logic for activating tech based on the turn of the game the player is in. + * + * You can control the turn in which a certain + * + * @author Edwin van der Wal + * @version 0.1 + */ +public class TurnbasedTechActivationDelegate implements IDelegate +{ + + private String m_name; + private String m_displayName; + private GameData m_data; + private IDelegateBridge m_bridge; + private PlayerID m_player; + + /** Creates new TechActivationDelegate */ + public TurnbasedTechActivationDelegate() + { + } + + public void initialize(String name, String displayName) + { + m_name = name; + m_displayName = displayName; + } + + /** + * Called before the delegate will run. In this class, this does all the + * work. + */ + public void start(IDelegateBridge aBridge, GameData gameData) + { + m_bridge = aBridge; + m_data = gameData; + m_player = aBridge.getPlayerID(); + List advances = new ArrayList(); + Iterator allAdvances = TechAdvance.getTechAdvances(gameData).iterator(); + + while(allAdvances.hasNext()) { + TechAdvance advance = allAdvances.next(); + if(Properties.getActivateTechOnTurn(gameData,advance.getProperty(),m_player.getName()) == gameData.getSequence().getRound()) + advances.add(advance); + } + + if ((advances != null) && (advances.size() > 0)) + { + // Start event + m_bridge.getHistoryWriter().startEvent(m_player.getName() + " activating " + advancesAsString(advances)); + + Iterator techsIter = advances.iterator(); + while (techsIter.hasNext()) + { + TechAdvance advance = techsIter.next(); + advance.perform(m_bridge.getPlayerID(), m_bridge, m_data); + TechTracker.addAdvance(m_player, m_data, m_bridge, advance); + } + } + } + + + // Return string representing all advances in collection + private String advancesAsString(Collection advances) + { + Iterator iter = advances.iterator(); + int count = advances.size(); + StringBuilder text = new StringBuilder(); + + while (iter.hasNext()) + { + TechAdvance advance = (TechAdvance) iter.next(); + text.append(advance.getName()); + count--; + if (count > 1) + text.append(", "); + if (count == 1) + text.append(" and "); + } + return text.toString(); + } + + public String getName() + { + return m_name; + } + + public String getDisplayName() + { + return m_displayName; + } + + /** + * Called before the delegate will stop running. + */ + public void end() + { + } + + /** + * Returns the state of the Delegate. + */ + public Serializable saveState() + { + return null; + } + + /** + * Loads the delegates state + */ + public void loadState(Serializable state) + { + + } + + /* + * @see games.strategy.engine.delegate.IDelegate#getRemoteType() + */ + public Class getRemoteType() + { + return null; + } + +} \ No newline at end of file --Apple-Mail-56-383032104 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii
--Apple-Mail-56-383032104--