- 2 new ability keywords: mustattack and cantattack
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-04-05 09:46:02 +00:00
parent 34c139a15d
commit a6c1776a90
12 changed files with 121 additions and 23 deletions
+2 -2
View File
@@ -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));
+5 -3
View File
@@ -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;
}
+12
View File
@@ -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;