Card: add addIntrinsicKeywords and fixed it in CardState

use it for CardFactory too
This commit is contained in:
Hanmac
2017-10-07 12:55:36 +00:00
parent 66af4ef831
commit da2faaeff4
3 changed files with 8 additions and 2 deletions

View File

@@ -3504,6 +3504,12 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} }
public final void addIntrinsicKeywords(final Iterable<String> s) {
if (currentState.addIntrinsicKeywords(s)) {
currentState.getView().updateKeywords(this, currentState);
}
}
public final void removeIntrinsicKeyword(final String s) { public final void removeIntrinsicKeyword(final String s) {
if (currentState.removeIntrinsicKeyword(s)) { if (currentState.removeIntrinsicKeyword(s)) {
currentState.getView().updateKeywords(this, currentState); currentState.getView().updateKeywords(this, currentState);

View File

@@ -424,8 +424,8 @@ public class CardFactory {
} }
private static void readCardFace(Card c, ICardFace face) { private static void readCardFace(Card c, ICardFace face) {
c.addIntrinsicKeywords(face.getKeywords());
for (String k : face.getKeywords()) c.addIntrinsicKeyword(k);
for (String r : face.getReplacements()) c.addReplacementEffect(ReplacementHandler.parseReplacement(r, c, true)); for (String r : face.getReplacements()) c.addReplacementEffect(ReplacementHandler.parseReplacement(r, c, true));
for (String s : face.getStaticAbilities()) c.addStaticAbility(s); for (String s : face.getStaticAbilities()) c.addStaticAbility(s);
for (String t : face.getTriggers()) c.addTrigger(TriggerHandler.parseTrigger(t, c, true)); for (String t : face.getTriggers()) c.addTrigger(TriggerHandler.parseTrigger(t, c, true));

View File

@@ -163,7 +163,7 @@ public class CardState extends GameObject {
boolean changed = false; boolean changed = false;
for (String k : keywords) { for (String k : keywords) {
if (addIntrinsicKeyword(k)) { if (addIntrinsicKeyword(k)) {
changed = false; changed = true;
} }
} }
return changed; return changed;