Erwan
- 2 new ability keywords: mustattack and cantattack
This commit is contained in:
@@ -598,9 +598,9 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
}
|
||||
|
||||
if (lordType == PARSER_LORD){
|
||||
game->addObserver(NEW ALord(id,card,lordTargets,lordIncludeSelf,0,0,j));
|
||||
game->addObserver(NEW ALord(id,card,lordTargets,lordIncludeSelf,0,0,j,0,modifier));
|
||||
}else if (lordType == PARSER_ASLONGAS){
|
||||
game->addObserver(NEW AKirdApe(id,card,lordTargets,lordIncludeSelf,0,0,j));
|
||||
game->addObserver(NEW AKirdApe(id,card,lordTargets,lordIncludeSelf,0,0,j,modifier));
|
||||
}else{
|
||||
if (tc){
|
||||
game->addObserver(NEW ABasicAbilityModifierUntilEOT(id, card, j, cost,tc, modifier));
|
||||
|
||||
@@ -272,9 +272,11 @@ Player * MTGCardInstance::controller(){
|
||||
}
|
||||
|
||||
int MTGCardInstance::canAttack(){
|
||||
if (!hasSummoningSickness() && !tapped && isACreature() && basicAbilities[Constants::DEFENSER] !=1)
|
||||
return 1;
|
||||
return 0;
|
||||
if (tapped) return 0;
|
||||
if (hasSummoningSickness()) return 0;
|
||||
if (basicAbilities[Constants::DEFENSER] || basicAbilities[Constants::CANTATTACK]) return 0;
|
||||
if (!isACreature()) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -88,6 +88,18 @@ int MTGAttackRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MTGAttackRule::Update(float dt){
|
||||
if (currentPhase != newPhase && currentPhase == Constants::MTG_PHASE_COMBATATTACKERS){
|
||||
Player * p = game->currentPlayer;
|
||||
MTGGameZone * z = p->game->inPlay;
|
||||
for (int i= 0; i < z->nb_cards; i++){
|
||||
MTGCardInstance * card = z->cards[i];
|
||||
if (!card->isAttacker() && card->has(Constants::MUSTATTACK)) reactToClick(card);
|
||||
}
|
||||
}
|
||||
MTGAbility::Update(dt);
|
||||
}
|
||||
|
||||
int MTGAttackRule::reactToClick(MTGCardInstance * card){
|
||||
if (!isReactingToClick(card)) return 0;
|
||||
card->attacker = 1;
|
||||
|
||||
Reference in New Issue
Block a user