Commit bca4aaeb authored by Chen Bill's avatar Chen Bill

class effect: const member function

parent b280dc92
......@@ -30,17 +30,17 @@ effect::effect(duel* pd) {
pduel = pd;
label.reserve(4);
}
int32 effect::is_disable_related() {
int32 effect::is_disable_related() const {
if (code == EFFECT_IMMUNE_EFFECT || code == EFFECT_DISABLE || code == EFFECT_CANNOT_DISABLE || code == EFFECT_FORBIDDEN)
return TRUE;
return FALSE;
}
int32 effect::is_self_destroy_related() {
int32 effect::is_self_destroy_related() const {
if(code == EFFECT_UNIQUE_CHECK || code == EFFECT_SELF_DESTROY || code == EFFECT_SELF_TOGRAVE)
return TRUE;
return FALSE;
}
int32 effect::is_can_be_forbidden() {
int32 effect::is_can_be_forbidden() const {
if (is_flag(EFFECT_FLAG_CANNOT_DISABLE) && !is_flag(EFFECT_FLAG_CANNOT_NEGATE))
return FALSE;
return TRUE;
......@@ -612,7 +612,7 @@ int32 effect::is_chainable(uint8 tp) {
}
return TRUE;
}
int32 effect::is_hand_trigger() {
int32 effect::is_hand_trigger() const {
return (range & LOCATION_HAND) && (type & EFFECT_TYPE_TRIGGER_O) && get_code_type() != CODE_PHASE;
}
//return: this can be reset by reset_level or not
......@@ -802,7 +802,7 @@ card* effect::get_owner() const {
return handler->overlay_target;
return owner;
}
uint8 effect::get_owner_player() {
uint8 effect::get_owner_player() const {
if(effect_owner != PLAYER_NONE)
return effect_owner;
return get_owner()->current.controler;
......@@ -814,17 +814,17 @@ card* effect::get_handler() const {
return handler->overlay_target;
return handler;
}
uint8 effect::get_handler_player() {
uint8 effect::get_handler_player() const {
if(is_flag(EFFECT_FLAG_FIELD_ONLY))
return effect_owner;
return get_handler()->current.controler;
}
int32 effect::in_range(card* pcard) {
int32 effect::in_range(card* pcard) const {
if(type & EFFECT_TYPE_XMATERIAL)
return handler->overlay_target ? TRUE : FALSE;
return pcard->current.is_location(range);
}
int32 effect::in_range(const chain& ch) {
int32 effect::in_range(const chain& ch) const {
if(type & EFFECT_TYPE_XMATERIAL)
return handler->overlay_target ? TRUE : FALSE;
return range & ch.triggering_location;
......
......@@ -67,9 +67,9 @@ public:
explicit effect(duel* pd);
~effect() = default;
int32 is_disable_related();
int32 is_self_destroy_related();
int32 is_can_be_forbidden();
int32 is_disable_related() const;
int32 is_self_destroy_related() const;
int32 is_can_be_forbidden() const;
int32 is_available(int32 neglect_disabled = FALSE);
int32 limit_counter_is_available();
int32 is_single_ready();
......@@ -87,7 +87,7 @@ public:
int32 is_player_effect_target(card* pcard);
int32 is_immuned(card* pcard);
int32 is_chainable(uint8 tp);
int32 is_hand_trigger();
int32 is_hand_trigger() const;
int32 reset(uint32 reset_level, uint32 reset_type);
void dec_count(uint8 playerid = PLAYER_NONE);
void recharge();
......@@ -103,11 +103,11 @@ public:
int32 get_speed();
effect* clone();
card* get_owner() const;
uint8 get_owner_player();
uint8 get_owner_player() const;
card* get_handler() const;
uint8 get_handler_player();
int32 in_range(card* pcard);
int32 in_range(const chain& ch);
uint8 get_handler_player() const;
int32 in_range(card* pcard) const;
int32 in_range(const chain& ch) const;
void set_activate_location();
void set_active_type();
uint32 get_active_type(uint8 uselast = TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment