fix and completely reworked affinity AGAIN.
moved it out of rules, it was FAR to error prone and after fixing bugs on this ability about 12 times, im done with it. noticed yesterday that it was removing the completely wrong amounts, and not maintaining its cost AT ALL. so i got sick of adjusting it as a rule, its now a statebased effect, called through gamestatebasedeffect as a side function. the new affinity is less then 100 lines of code, down from 300. to acomplish the effect with FAR less effort. it is also FAR easier to maintain in the future if i die or leave the scene or whatever. added a new count tool for MTGGameZones canByCanTarget...which allows for returns of amounts based on if it can be targetted by a tc. much like how listmaintainer does it. affinitygreencreature will not be the only ability to use this function, just a heads up. its just the first to do so. hopefully this much more accurate affinity will be the last version...considering adding the other types which old affinity couldnt handle :D
This commit is contained in:
@@ -73,6 +73,7 @@ class GameObserver{
|
||||
~GameObserver();
|
||||
void gameStateBasedEffects();
|
||||
void enchantmentStatus();
|
||||
void Affinity();
|
||||
void eventOccured();
|
||||
void addObserver(MTGAbility * observer);
|
||||
void removeObserver(ActionElement * observer);
|
||||
|
||||
@@ -6,6 +6,7 @@ using std::map;
|
||||
|
||||
#include "MTGDeck.h"
|
||||
#include "MTGCardInstance.h"
|
||||
#include "TargetChooser.h"
|
||||
|
||||
#define MTG_MAX_PLAYER_CARDS 100
|
||||
|
||||
@@ -80,6 +81,7 @@ class MTGGameZone {
|
||||
MTGCardInstance * hasCard(MTGCardInstance * card);
|
||||
void cleanupPhase();
|
||||
int countByType(const char * value);
|
||||
int countByCanTarget(TargetChooser * tc);
|
||||
MTGCardInstance * findByName(string name);
|
||||
int hasAbility(int ability); //returns 1 if one of the cards in the zone has the ability, 0 otherwise
|
||||
int hasType(const char * value); //returns 1 if one of the cards in the zone has the type, 0 otherwise
|
||||
|
||||
@@ -170,16 +170,6 @@ public:
|
||||
int testDestroy();
|
||||
virtual MTGPersistRule * clone() const;
|
||||
};
|
||||
//affinity rules
|
||||
class MTGAffinityRule: public MTGAbility
|
||||
{
|
||||
public:
|
||||
MTGAffinityRule(int _id);
|
||||
int receiveEvent(WEvent * event);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
int testDestroy();
|
||||
virtual MTGAffinityRule * clone() const;
|
||||
};
|
||||
//unearths destruction if leaves play effect
|
||||
class MTGUnearthRule: public MTGAbility
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user