Erwan
- Fix for issue 284 (Damage not triggering when creature dies in combat phase)
This commit is contained in:
@@ -347,6 +347,8 @@ meekstone.txt
|
|||||||
memnarch.txt
|
memnarch.txt
|
||||||
memory_erosion.txt
|
memory_erosion.txt
|
||||||
millstone.txt
|
millstone.txt
|
||||||
|
mirri_the_cursed.txt
|
||||||
|
mirri_the_cursed2_i284.txt
|
||||||
misc01.txt
|
misc01.txt
|
||||||
moat.txt
|
moat.txt
|
||||||
mobile_fort.txt
|
mobile_fort.txt
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#Test @dmaaged on Mirri the Cursed
|
||||||
|
# Whenever Mirri the Cursed deals combat damage to a creature, put a +1/+1 counter on Mirri the Cursed.
|
||||||
|
# 3/2
|
||||||
|
[INIT]
|
||||||
|
COMBATATTACKERS
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:Mirri the Cursed,mountain
|
||||||
|
hand:shock
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:Angelic Wall
|
||||||
|
[DO]
|
||||||
|
Mirri the Cursed
|
||||||
|
next
|
||||||
|
Angelic Wall
|
||||||
|
next
|
||||||
|
#damages first strike
|
||||||
|
next
|
||||||
|
#combat end
|
||||||
|
next
|
||||||
|
#main 2
|
||||||
|
mountain
|
||||||
|
shock
|
||||||
|
Mirri the Cursed
|
||||||
|
[ASSERT]
|
||||||
|
SECONDMAIN
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:Mirri the Cursed,mountain
|
||||||
|
graveyard:shock
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:Angelic Wall
|
||||||
|
[END]
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#Bug: @damaged doesn't trigger if creature goes to graveyard
|
||||||
|
[INIT]
|
||||||
|
COMBATATTACKERS
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:Mirri the Cursed,mountain
|
||||||
|
hand:shock
|
||||||
|
[PLAYER2]
|
||||||
|
inplay:vampire bats
|
||||||
|
[DO]
|
||||||
|
Mirri the Cursed
|
||||||
|
next
|
||||||
|
vampire bats
|
||||||
|
next
|
||||||
|
#damages fir strike
|
||||||
|
next
|
||||||
|
#combat end
|
||||||
|
next
|
||||||
|
#main 2
|
||||||
|
mountain
|
||||||
|
shock
|
||||||
|
Mirri the Cursed
|
||||||
|
[ASSERT]
|
||||||
|
SECONDMAIN
|
||||||
|
[PLAYER1]
|
||||||
|
inplay:Mirri the Cursed,mountain
|
||||||
|
graveyard:shock
|
||||||
|
[PLAYER2]
|
||||||
|
graveyard:vampire bats
|
||||||
|
[END]
|
||||||
@@ -59,6 +59,7 @@ class Interruptible: public PlayGuiObject, public Targetable{
|
|||||||
Interruptible(bool hasFocus = false):PlayGuiObject(40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
Interruptible(bool hasFocus = false):PlayGuiObject(40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
|
||||||
virtual const string getDisplayName() const {return "stack object";};
|
virtual const string getDisplayName() const {return "stack object";};
|
||||||
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false);
|
void Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad = false);
|
||||||
|
virtual int receiveEvent(WEvent * event) {return 0;};
|
||||||
#if defined (WIN32) || defined (LINUX)
|
#if defined (WIN32) || defined (LINUX)
|
||||||
virtual void Dump();
|
virtual void Dump();
|
||||||
#endif
|
#endif
|
||||||
@@ -180,6 +181,7 @@ class ActionStack :public GuiLayer{
|
|||||||
int resolve();
|
int resolve();
|
||||||
int has(Interruptible * action);
|
int has(Interruptible * action);
|
||||||
int has(MTGAbility * ability);
|
int has(MTGAbility * ability);
|
||||||
|
int receiveEventPlus(WEvent * event);
|
||||||
#if defined (WIN32) || defined (LINUX)
|
#if defined (WIN32) || defined (LINUX)
|
||||||
void Dump();
|
void Dump();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class DamageStack : public GuiLayer, public Interruptible{
|
|||||||
GameObserver* game;
|
GameObserver* game;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
int receiveEvent(WEvent * event);
|
||||||
int resolve();
|
int resolve();
|
||||||
void Render();
|
void Render();
|
||||||
virtual ostream& toString(ostream& out) const;
|
virtual ostream& toString(ostream& out) const;
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ struct WEventDamage : public WEvent {
|
|||||||
virtual Targetable * getTarget(int target);
|
virtual Targetable * getTarget(int target);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct WEventDamageStackResolved : public WEvent {
|
||||||
|
WEventDamageStackResolved();
|
||||||
|
};
|
||||||
|
|
||||||
struct WEventPhaseChange : public WEvent {
|
struct WEventPhaseChange : public WEvent {
|
||||||
Phase * from;
|
Phase * from;
|
||||||
Phase * to;
|
Phase * to;
|
||||||
|
|||||||
@@ -547,6 +547,15 @@ Interruptible * ActionStack::getLatest(int state){
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ActionStack::receiveEventPlus(WEvent * event) {
|
||||||
|
int result = 0;
|
||||||
|
for (int i = 0; i < mCount ; ++i){
|
||||||
|
Interruptible * current = (Interruptible *)mObjects[i];
|
||||||
|
result += current->receiveEvent(event);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void ActionStack::Update(float dt){
|
void ActionStack::Update(float dt){
|
||||||
askIfWishesToInterrupt = NULL;
|
askIfWishesToInterrupt = NULL;
|
||||||
//modal = 0;
|
//modal = 0;
|
||||||
|
|||||||
@@ -178,18 +178,30 @@ DamageStack::DamageStack() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Damage Stack resolve process:
|
||||||
|
1 - apply damages to targets. For each of them, send an event to the GameObserver (for Damage triggers)
|
||||||
|
2 - Once this is done, send a "Damage Stakc Resolved" event to the GameObserver
|
||||||
|
3 - Once that message is received on the DamageStack's side, do the "afterDamage" effects (send to graveyard, etc...)
|
||||||
|
Using events in 2 and 3 guarantees that the "send to graveyard" effect will only apply AFTER Damaged triggers are applied
|
||||||
|
*/
|
||||||
int DamageStack::resolve(){
|
int DamageStack::resolve(){
|
||||||
for (int i = mCount-1; i>= 0; i--){
|
for (int i = mCount-1; i>= 0; i--){
|
||||||
Damage * damage = (Damage*)mObjects[i];
|
Damage * damage = (Damage*)mObjects[i];
|
||||||
if (damage->state == NOT_RESOLVED) damage->resolve();
|
if (damage->state == NOT_RESOLVED) damage->resolve();
|
||||||
//damage->resolve();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameObserver::GetInstance()->receiveEvent(NEW WEventDamageStackResolved());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DamageStack::receiveEvent(WEvent * e) {
|
||||||
|
WEventDamageStackResolved *event = dynamic_cast<WEventDamageStackResolved*>(e);
|
||||||
|
if (!event) return 0;
|
||||||
|
|
||||||
for (int i = mCount-1; i>= 0; i--){
|
for (int i = mCount-1; i>= 0; i--){
|
||||||
Damage * damage = (Damage*)mObjects[i];
|
Damage * damage = (Damage*)mObjects[i];
|
||||||
if (damage->state == RESOLVED_OK) damage->target->afterDamage();
|
if (damage->state == RESOLVED_OK) damage->target->afterDamage();
|
||||||
//damage->target->afterDamage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -601,7 +601,7 @@ void GameObserver::untapPhase(){
|
|||||||
int GameObserver::receiveEvent(WEvent * e){
|
int GameObserver::receiveEvent(WEvent * e){
|
||||||
if (!e) return 0;
|
if (!e) return 0;
|
||||||
eventsQueue.push(e);
|
eventsQueue.push(e);
|
||||||
if (eventsQueue.size() > 1) return -1;
|
if (eventsQueue.size() > 1) return -1; //resolving events can generate more events
|
||||||
int result = 0;
|
int result = 0;
|
||||||
while(eventsQueue.size()){
|
while(eventsQueue.size()){
|
||||||
WEvent * ev = eventsQueue.front();
|
WEvent * ev = eventsQueue.front();
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ WEventZoneChange::WEventZoneChange(MTGCardInstance * card, MTGGameZone * from, M
|
|||||||
|
|
||||||
WEventDamage::WEventDamage(Damage *damage) : WEvent(DAMAGE), damage(damage){}
|
WEventDamage::WEventDamage(Damage *damage) : WEvent(DAMAGE), damage(damage){}
|
||||||
|
|
||||||
|
WEventDamageStackResolved::WEventDamageStackResolved() : WEvent(){}
|
||||||
|
|
||||||
WEventCardUpdate::WEventCardUpdate(MTGCardInstance * card) : WEvent(), card(card) {};
|
WEventCardUpdate::WEventCardUpdate(MTGCardInstance * card) : WEvent(), card(card) {};
|
||||||
|
|
||||||
WEventPhaseChange::WEventPhaseChange(Phase * from, Phase * to) : WEvent(CHANGE_PHASE), from(from), to(to){}
|
WEventPhaseChange::WEventPhaseChange(Phase * from, Phase * to) : WEvent(CHANGE_PHASE), from(from), to(to){}
|
||||||
|
|||||||
Reference in New Issue
Block a user