public void removeSpell(SpellWrapper spell) { String duration = spell.getGameObject().getThisAttribute("duration"); ArrayList list = getList(duration); if (list != null && list.contains(spell.getGameObject().getStringId())) { list = new ArrayList(list); list.remove(spell.getGameObject().getStringId()); setList(duration, list); } }
public void restoreBewitchingNullifiedSpells(GameObject target, SpellWrapper exclude) { for (SpellWrapper spell : getAffectingSpells(target)) { if (exclude == null || !exclude.getGameObject().equals(spell.getGameObject())) { if (spell.isNullified()) { spell.restoreSpell(); // System.err.println(spell.getGameObject().getName()+" is restored after nullification"); } } } }
private void expireBewitchingSpells(GameObject target, SpellWrapper exclude, boolean nullify) { for (SpellWrapper spell : getAffectingSpells(target)) { if (exclude != null && exclude.getGameObject().equals(spell.getGameObject())) continue; if (!nullify) { spell.removeTarget(target); if (spell.getTargetCount() == 0) { spell.expireSpell(); // System.err.println(spell.getGameObject().getName()+" is expired"); } } else { spell.nullifySpell(); // System.err.println(spell.getGameObject().getName()+" is nullified"); } } }
/** * Adds a spell to the master list. Organizes into three bins: permanent, day, combat. All other * spell duration types (instant,attack,phase,move) are ignored here. */ public void addSpell(SpellWrapper spell) { String duration = spell.getGameObject().getThisAttribute("duration"); if (PERMANENT_SPELLS.equals(duration)) { addPermanentSpell(spell); } else if (DAY_SPELLS.equals(duration)) { addDaySpell(spell); } else if (COMBAT_SPELLS.equals(duration)) { addCombatSpell(spell); } else if (PHASE_SPELLS.equals(duration)) { addPhaseSpell(spell); } else if (MOVE_SPELLS.equals(duration)) { addMoveSpell(spell); } }
private void addPhaseSpell(SpellWrapper spell) { // only add a phase spell that has been activated (has a chit) if (spell.hasPhaseChit()) { addListItem(PHASE_SPELLS, spell.getGameObject().getStringId()); } }
private void addMoveSpell(SpellWrapper spell) { addListItem(MOVE_SPELLS, spell.getGameObject().getStringId()); }
private void addCombatSpell(SpellWrapper spell) { addListItem(COMBAT_SPELLS, spell.getGameObject().getStringId()); }
private void addDaySpell(SpellWrapper spell) { addListItem(DAY_SPELLS, spell.getGameObject().getStringId()); }
private void addPermanentSpell(SpellWrapper spell) { addListItem(PERMANENT_SPELLS, spell.getGameObject().getStringId()); }