added bloodthirst:number ability
This commit is contained in:
@@ -82,7 +82,8 @@ int Damage::resolve(){
|
||||
MTGCardInstance * _target = (MTGCardInstance *)target;
|
||||
for (int i = 0; i < damage; i++){
|
||||
//this will be changed to poison counters.
|
||||
a = target->dealDamage(1);
|
||||
a = target->dealDamage(1);
|
||||
target->damageCount += 1;
|
||||
}
|
||||
_target->poisonCount += 1;
|
||||
return a;
|
||||
@@ -92,6 +93,7 @@ int Damage::resolve(){
|
||||
for (int i = 0; i < damage; i++){
|
||||
//this will be changed to poison counters.
|
||||
a = target->dealDamage(1);
|
||||
target->damageCount += 1;
|
||||
}
|
||||
_target->poisonCount += 2;
|
||||
return a;
|
||||
@@ -101,11 +103,13 @@ int Damage::resolve(){
|
||||
for (int i = 0; i < damage; i++){
|
||||
//this will be changed to poison counters.
|
||||
a = target->dealDamage(1);
|
||||
target->damageCount += 1;
|
||||
}
|
||||
_target->poisonCount += 3;
|
||||
return a;
|
||||
}
|
||||
a = target->dealDamage(damage);
|
||||
target->damageCount += 1;
|
||||
}
|
||||
//Send (Damage/Replaced effect) event to listeners
|
||||
g->receiveEvent(e);
|
||||
|
||||
@@ -97,6 +97,7 @@ void GameObserver::nextGamePhase(){
|
||||
if (currentGamePhase == Constants::MTG_PHASE_BEFORE_BEGIN){
|
||||
cleanupPhase();
|
||||
currentPlayer->canPutLandsIntoPlay = 1;
|
||||
currentPlayer->damageCount = 0;
|
||||
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
|
||||
mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn;
|
||||
mLayers->actionLayer()->Update(0);
|
||||
|
||||
@@ -988,6 +988,16 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
ab = NEW ABecomes(id,card,target,stypes,pt,sabilities);
|
||||
}return ab;
|
||||
}
|
||||
//bloodthirst
|
||||
found = s.find("bloodthirst:");
|
||||
if (found != string::npos){
|
||||
size_t start = s.find(":",found);
|
||||
size_t end = s.find(" ",start);
|
||||
int amount;
|
||||
if (end != string::npos){amount = atoi(s.substr(start+1,end-start-1).c_str());}
|
||||
else{amount = atoi(s.substr(start+1).c_str());}
|
||||
MTGAbility * a = NEW ABloodThirst(id,card,target,amount);
|
||||
return a;}
|
||||
|
||||
//ManaRedux
|
||||
found = s.find("colorless:");
|
||||
|
||||
@@ -343,6 +343,7 @@ int MTGCardInstance::canBlock(MTGCardInstance * opponent){
|
||||
if (!opponent->isAttacker()) return 0;
|
||||
// Comprehensive rule 502.7f : If a creature with protection attacks, it can't be blocked by creatures that have the stated quality.
|
||||
if (opponent->protectedAgainst(this)) return 0;
|
||||
if (opponent->power > !(defenser->power) && opponent->has(basicAbilities[Constants::POWERBLOCKER])) return 0;
|
||||
if (opponent->cantBeBlockedBy(this)) return 0;
|
||||
if (opponent->basicAbilities[Constants::UNBLOCKABLE]) return 0;
|
||||
if (opponent->basicAbilities[Constants::ONEBLOCKER] && opponent->blocked) return 0;
|
||||
|
||||
@@ -60,6 +60,7 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"poisondamage",
|
||||
"poisontwodamage",
|
||||
"poisonthreedamage",
|
||||
"powerblocker"
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ Player::Player(MTGPlayerCards * deck, string file, string fileSmall) : Damageabl
|
||||
manaPool = NEW ManaPool(this);
|
||||
canPutLandsIntoPlay = 1;
|
||||
poisonCount = 0;
|
||||
damageCount = 0;
|
||||
mAvatar = NULL;
|
||||
mAvatarTex = NULL;
|
||||
type_as_damageable = DAMAGEABLE_PLAYER;
|
||||
@@ -87,10 +88,16 @@ int Player::afterDamage(){
|
||||
int Player::poisoned(){
|
||||
return poisonCount;
|
||||
}
|
||||
int Player::damaged(){
|
||||
return damageCount;
|
||||
}
|
||||
//Cleanup phase at the end of a turn
|
||||
void Player::cleanupPhase(){
|
||||
Player *p;
|
||||
game->inPlay->cleanupPhase();
|
||||
game->graveyard->cleanupPhase();
|
||||
|
||||
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& out, const Player& p)
|
||||
|
||||
@@ -40,6 +40,7 @@ MTGCardInstance * Rules::getCardByMTGId(int mtgid){
|
||||
RulesPlayerData::RulesPlayerData(){
|
||||
life = 20;
|
||||
poisonCount = 0;
|
||||
damageCount = 0;
|
||||
manapool = NEW ManaCost();
|
||||
avatar = "";
|
||||
}
|
||||
@@ -80,6 +81,9 @@ void RulesState::parsePlayerState(int playerId, string s){
|
||||
return;
|
||||
}else if(areaS.compare("poisonCount") == 0){
|
||||
playerData[playerId].poisonCount = atoi((s.substr(limiter+1)).c_str());
|
||||
return;
|
||||
}else if(areaS.compare("damageCount") == 0){
|
||||
playerData[playerId].damageCount = atoi((s.substr(limiter+1)).c_str());
|
||||
return;
|
||||
}else if(areaS.compare("avatar") == 0){
|
||||
playerData[playerId].avatar = s.substr(limiter+1);
|
||||
@@ -278,6 +282,7 @@ void Rules::initGame(){
|
||||
Player * p = g->players[i];
|
||||
p->life = initState.playerData[i].life;
|
||||
p->poisonCount = initState.playerData[i].poisonCount;
|
||||
p->damageCount = initState.playerData[i].damageCount;
|
||||
p->getManaPool()->copy(initState.playerData[i].manapool);
|
||||
if (initState.playerData[i].avatar.size()) {
|
||||
p->loadAvatar(initState.playerData[i].avatar);
|
||||
@@ -324,6 +329,7 @@ void RulesPlayerData::cleanup(){
|
||||
}
|
||||
life=20;
|
||||
poisonCount=0;
|
||||
damageCount=0;
|
||||
}
|
||||
|
||||
void RulesState::cleanup(){
|
||||
|
||||
Reference in New Issue
Block a user