Commit ee2dbc00 authored by Mathieu Hilaire's avatar Mathieu Hilaire

trigger gold implemented

parent e0e19cfe
...@@ -333,7 +333,9 @@ FIREBOLT ...@@ -333,7 +333,9 @@ FIREBOLT
DEFAULT_TRIGGER DEFAULT_TRIGGER
#effect descriptor #effect descriptor
1 1
TRAP_TRIGGER TRIGGER_GOLD
#abilityList #abilityList
0 1
TEST_SUICIDE
...@@ -269,6 +269,12 @@ public class EffectBuilder implements Serializable{ ...@@ -269,6 +269,12 @@ public class EffectBuilder implements Serializable{
} }
}; };
} }
/**
* A trigger increasing the amount of gold of the characters in the area. if it happens then send a destroy event
* to the entity responsable.
* @return An instance of Effect doing what is described above.
*/
Effect trigger_gold() { Effect trigger_gold() {
return new Effect() { return new Effect() {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -279,7 +285,7 @@ public class EffectBuilder implements Serializable{ ...@@ -279,7 +285,7 @@ public class EffectBuilder implements Serializable{
for (Integer targetID : targetCharacterIDList) { for (Integer targetID : targetCharacterIDList) {
try { try {
if(gameContent.getGameState().getEntity(casterCharacterID).getOwned_character() != targetID) { if(gameContent.getGameState().getEntity(casterCharacterID).getOwned_character() != targetID) {
gameContent.getGameState().getCharacter(targetID).takeDamage(Math.max(1, 0)); gameContent.getGameState().getCharacter(targetID).setGold( gameContent.getGameState().getCharacter(targetID).getGold() + 1 );
hit =true; hit =true;
} }
} catch (EntityNotFoundExeption entityNotFoundExeption) { } catch (EntityNotFoundExeption entityNotFoundExeption) {
......
...@@ -94,8 +94,8 @@ public final class Character extends Being { ...@@ -94,8 +94,8 @@ public final class Character extends Being {
} }
/** /**
* Returns the character's gold value. * Set the character's gold value.
* @return the character's gold value. * @set the character's gold value.
*/ */
public void setGold( int gold2) { public void setGold( int gold2) {
this.gold = gold2; this.gold = gold2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment