View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric;
2   
3   import java.util.logging.Logger;
4   
5   import cz.cuni.amis.pogamut.base.agent.module.SensomotoricModule;
6   import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentInfo;
7   import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot;
8   import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Combo;
9   
10  /**
11   * Simplifies performance of "adrenaline combos"
12   * 
13   * @author Jakub Gemrot aka Jimmy
14   */
15  public class AdrenalineCombo extends SensomotoricModule<UT2004Bot> {
16  
17  	private AgentInfo info;
18  
19  	/**
20  	 * Tells whether you have adrenaline >= 100, note that using the combo won't change the adrenaline level in the same "logic-cycle".
21  	 * @return
22  	 */
23  	public boolean canPerformCombo() {
24  		return info.getAdrenaline() >= 100;
25  	}
26      
27  	/**
28  	 * Perform "Berserk" combo (bigger damage).
29  	 * @return whether the combo has been executed
30  	 */
31  	public boolean performBerserk() {
32  		if (canPerformCombo()) {
33  			act.act(new Combo("xGame.ComboBerserk"));
34  			return true;
35  		} else {
36  			return false;
37  		}
38  	}
39  	
40  	/**
41  	 * Perform "Defensive" combo (every few seconds adds health).
42  	 * @return whether the combo has been executed
43  	 */
44  	public boolean performDefensive() {
45  		if (canPerformCombo()) {
46  			act.act(new Combo("xGame.ComboDefensive"));
47  			return true;
48  		} else {
49  			return false;
50  		}
51  	}
52  	
53  	/**
54  	 * Perform "Defensive" combo (bot is invisible and is very hard to spot), note that this combo does not affects PogamutBots ;-(
55  	 * @return whether the combo has been executed
56  	 */
57  	public boolean performInvisible() {
58  		if (canPerformCombo()) {
59  			act.act(new Combo("xGame.ComboDefensive"));
60  			return true;
61  		} else {
62  			return false;
63  		}
64  	}
65  	
66  	/**
67  	 * Perform "Defensive" combo (bots speed is increased), not advised as it usually breaks running constants, which breaks bot navigation in turn.
68  	 * @return whether the combo has been executed
69  	 */
70  	public boolean performSpeed() {
71  		if (canPerformCombo()) {
72  			act.act(new Combo("xGame.ComboDefensive"));
73  			return true;
74  		} else {
75  			return false;
76  		}
77  	}
78  	
79      public AdrenalineCombo(UT2004Bot bot, AgentInfo info) {
80          this(bot, info, null);
81      }
82      
83      public AdrenalineCombo(UT2004Bot bot, AgentInfo info, Logger log) {
84          super(bot, log);
85          this.info = info;
86          cleanUp();
87      }
88      
89      @Override
90      protected void cleanUp() {
91      	super.cleanUp();
92      }
93      
94  }
95