Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #9 : Il y a maintenant un défenseur, qui cherche les snaffles p…
…rès de mon but, et un attaquant, qui les envoie chez l'adversaire. Le code est souple, MAIS il y a de gros problèmes de détermination des snaffles cibles : le calcul de distance des snaffles n'est pas convergeant.
- Loading branch information
Showing
11 changed files
with
234 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
multiplayer/fantastic-bits/src/main/java/org/ndx/codingame/fantastic/spells/AccioStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.ndx.codingame.fantastic.spells; | ||
|
||
public class AccioStatus extends SpellStatus { | ||
public AccioStatus() { | ||
super(6); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...ayer/fantastic-bits/src/main/java/org/ndx/codingame/fantastic/spells/ObliviateStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.ndx.codingame.fantastic.spells; | ||
|
||
import org.ndx.codingame.fantastic.status.StatusElement; | ||
|
||
public class ObliviateStatus extends SpellStatus implements StatusElement { | ||
|
||
public ObliviateStatus() { | ||
super(3); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
multiplayer/fantastic-bits/src/main/java/org/ndx/codingame/fantastic/spells/SpellStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.ndx.codingame.fantastic.spells; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.ndx.codingame.fantastic.entities.Entity; | ||
import org.ndx.codingame.fantastic.status.StatusElement; | ||
|
||
public class SpellStatus implements StatusElement { | ||
private Map<Entity, Integer> entities = new HashMap<>(); | ||
|
||
private final int duration; | ||
|
||
public SpellStatus(int duration) { | ||
super(); | ||
this.duration = duration; | ||
} | ||
|
||
public void applyOn(Entity entity) { | ||
entities.put(entity, duration); | ||
} | ||
|
||
public boolean isAppliedOn(Entity entity) { | ||
return entities.containsKey(entity); | ||
} | ||
|
||
@Override | ||
public void advanceOneTurn() { | ||
List<Entity> list = new ArrayList<>(entities.keySet()); | ||
for (Entity entity : list) { | ||
int durationOf = entities.get(entity); | ||
if(durationOf>1) { | ||
entities.put(entity, durationOf-1); | ||
} else { | ||
entities.remove(entity); | ||
} | ||
} | ||
} | ||
|
||
|
||
} |