Possessions can be an extra one (worn in addition...) based on whom they are attached (or being attached) to.

This commit is contained in:
marcins78@gmail.com
2011-11-23 19:15:11 +00:00
parent 1ca9f85146
commit e47573616f
6 changed files with 9 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ public abstract class AbstractAttachable extends AbstractLotroCardBlueprint {
return _possessionClass;
}
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self, PhysicalCard attachedTo) {
return false;
}
@@ -43,13 +43,13 @@ public abstract class AbstractAttachable extends AbstractLotroCardBlueprint {
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
PossessionClass possessionClass = getPossessionClass();
if (possessionClass != null) {
boolean extraPossessionClass = isExtraPossessionClass(game, self);
boolean extraPossessionClass = isExtraPossessionClass(game, self, physicalCard);
List<PhysicalCard> attachedCards = game.getGameState().getAttachedCards(physicalCard);
Collection<PhysicalCard> matchingClassPossessions = Filters.filter(attachedCards, gameState, modifiersQuerying, Filters.or(CardType.POSSESSION, CardType.ARTIFACT), possessionClass);
if (matchingClassPossessions.size() > 1)
return false;
if (!extraPossessionClass && matchingClassPossessions.size() == 1 &&
!((AbstractAttachable) matchingClassPossessions.iterator().next().getBlueprint()).isExtraPossessionClass(game, self))
!((AbstractAttachable) matchingClassPossessions.iterator().next().getBlueprint()).isExtraPossessionClass(game, self, physicalCard))
return false;
}
return true;

View File

@@ -48,7 +48,7 @@ public class Card1_216 extends AbstractAttachable {
}
@Override
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self, PhysicalCard attachedTo) {
return true;
}

View File

@@ -30,7 +30,7 @@ public class Card2_010 extends AbstractAttachableFPPossession {
}
@Override
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self, PhysicalCard attachedTo) {
return true;
}

View File

@@ -32,7 +32,7 @@ public class Card2_032 extends AbstractAttachableFPPossession {
}
@Override
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self, PhysicalCard attachedTo) {
return true;
}

View File

@@ -33,7 +33,7 @@ public class Card2_050 extends AbstractAttachable {
}
@Override
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self, PhysicalCard attachedTo) {
return true;
}

View File

@@ -35,9 +35,8 @@ public class Card9_017 extends AbstractAttachableFPPossession {
}
@Override
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
PhysicalCard to = self.getAttachedTo();
return (to != null && to.getBlueprint().getName().equals("Aragorn"));
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self, PhysicalCard attachedTo) {
return (attachedTo.getBlueprint().getName().equals("Aragorn"));
}
@Override