Commit f3fb923b authored by mercury233's avatar mercury233
parents fa3c18f5 df9a103a
...@@ -3314,28 +3314,6 @@ int32 card::is_removeable_as_cost(uint8 playerid) { ...@@ -3314,28 +3314,6 @@ int32 card::is_removeable_as_cost(uint8 playerid) {
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
int32 card::is_attack_decreasable_as_cost(uint8 playerid, int32 val) {
if(!(data.type & TYPE_MONSTER) && !(get_type() & TYPE_MONSTER))
return FALSE;
if(!(current.location & LOCATION_MZONE) || is_position(POS_FACEDOWN))
return FALSE;
if(is_affected_by_effect(EFFECT_SET_ATTACK_FINAL) || is_affected_by_effect(EFFECT_REVERSE_UPDATE))
return FALSE;
if(val && get_attack() < val)
return FALSE;
return TRUE;
}
int32 card::is_defense_decreasable_as_cost(uint8 playerid, int32 val) {
if(!(data.type & TYPE_MONSTER) && !(get_type() & TYPE_MONSTER))
return FALSE;
if(!(current.location & LOCATION_MZONE) || is_position(POS_FACEDOWN) || (data.type & TYPE_LINK))
return FALSE;
if(is_affected_by_effect(EFFECT_SET_DEFENSE_FINAL) || is_affected_by_effect(EFFECT_REVERSE_UPDATE))
return FALSE;
if(val && get_defense() < val)
return FALSE;
return TRUE;
}
int32 card::is_releasable_by_summon(uint8 playerid, card *pcard) { int32 card::is_releasable_by_summon(uint8 playerid, card *pcard) {
if(is_status(STATUS_SUMMONING)) if(is_status(STATUS_SUMMONING))
return FALSE; return FALSE;
......
...@@ -188,7 +188,7 @@ public: ...@@ -188,7 +188,7 @@ public:
explicit card(duel* pd); explicit card(duel* pd);
~card(); ~card();
static bool card_operation_sort(card* c1, card* c2); static bool card_operation_sort(card* c1, card* c2);
const bool is_extra_deck_monster() { return !!(data.type & 0x4802040); } const bool is_extra_deck_monster() { return !!(data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK)); }
uint32 get_infos(byte* buf, int32 query_flag, int32 use_cache = TRUE); uint32 get_infos(byte* buf, int32 query_flag, int32 use_cache = TRUE);
uint32 get_info_location(); uint32 get_info_location();
...@@ -320,8 +320,6 @@ public: ...@@ -320,8 +320,6 @@ public:
int32 is_destructable_by_effect(effect* peffect, uint8 playerid); int32 is_destructable_by_effect(effect* peffect, uint8 playerid);
int32 is_removeable(uint8 playerid); int32 is_removeable(uint8 playerid);
int32 is_removeable_as_cost(uint8 playerid); int32 is_removeable_as_cost(uint8 playerid);
int32 is_attack_decreasable_as_cost(uint8 playerid, int32 val);
int32 is_defense_decreasable_as_cost(uint8 playerid, int32 val);
int32 is_releasable_by_summon(uint8 playerid, card* pcard); int32 is_releasable_by_summon(uint8 playerid, card* pcard);
int32 is_releasable_by_nonsummon(uint8 playerid); int32 is_releasable_by_nonsummon(uint8 playerid);
int32 is_releasable_by_effect(uint8 playerid, effect* peffect); int32 is_releasable_by_effect(uint8 playerid, effect* peffect);
...@@ -349,119 +347,6 @@ public: ...@@ -349,119 +347,6 @@ public:
int32 is_can_be_link_material(card* scard); int32 is_can_be_link_material(card* scard);
}; };
//Locations
#define LOCATION_DECK 0x01 //
#define LOCATION_HAND 0x02 //
#define LOCATION_MZONE 0x04 //
#define LOCATION_SZONE 0x08 //
#define LOCATION_GRAVE 0x10 //
#define LOCATION_REMOVED 0x20 //
#define LOCATION_EXTRA 0x40 //
#define LOCATION_OVERLAY 0x80 //
#define LOCATION_ONFIELD 0x0c //
#define LOCATION_FZONE 0x100 //
#define LOCATION_PZONE 0x200 //
//Positions
#define POS_FACEUP_ATTACK 0x1
#define POS_FACEDOWN_ATTACK 0x2
#define POS_FACEUP_DEFENSE 0x4
#define POS_FACEDOWN_DEFENSE 0x8
#define POS_FACEUP 0x5
#define POS_FACEDOWN 0xa
#define POS_ATTACK 0x3
#define POS_DEFENSE 0xc
//Flip effect flags
#define NO_FLIP_EFFECT 0x10000
#define FLIP_SET_AVAILABLE 0x20000
//Types
#define TYPE_MONSTER 0x1 //
#define TYPE_SPELL 0x2 //
#define TYPE_TRAP 0x4 //
#define TYPE_NORMAL 0x10 //
#define TYPE_EFFECT 0x20 //
#define TYPE_FUSION 0x40 //
#define TYPE_RITUAL 0x80 //
#define TYPE_TRAPMONSTER 0x100 //
#define TYPE_SPIRIT 0x200 //
#define TYPE_UNION 0x400 //
#define TYPE_DUAL 0x800 //
#define TYPE_TUNER 0x1000 //
#define TYPE_SYNCHRO 0x2000 //
#define TYPE_TOKEN 0x4000 //
#define TYPE_QUICKPLAY 0x10000 //
#define TYPE_CONTINUOUS 0x20000 //
#define TYPE_EQUIP 0x40000 //
#define TYPE_FIELD 0x80000 //
#define TYPE_COUNTER 0x100000 //
#define TYPE_FLIP 0x200000 //
#define TYPE_TOON 0x400000 //
#define TYPE_XYZ 0x800000 //
#define TYPE_PENDULUM 0x1000000 //
#define TYPE_SPSUMMON 0x2000000 //
#define TYPE_LINK 0x4000000 //
//Attributes
#define ATTRIBUTE_EARTH 0x01 //
#define ATTRIBUTE_WATER 0x02 //
#define ATTRIBUTE_FIRE 0x04 //
#define ATTRIBUTE_WIND 0x08 //
#define ATTRIBUTE_LIGHT 0x10 //
#define ATTRIBUTE_DARK 0x20 //
#define ATTRIBUTE_DEVINE 0x40 //
//Races
#define RACE_WARRIOR 0x1 //
#define RACE_SPELLCASTER 0x2 //
#define RACE_FAIRY 0x4 //
#define RACE_FIEND 0x8 //
#define RACE_ZOMBIE 0x10 //
#define RACE_MACHINE 0x20 //
#define RACE_AQUA 0x40 //
#define RACE_PYRO 0x80 //
#define RACE_ROCK 0x100 //
#define RACE_WINDBEAST 0x200 //
#define RACE_PLANT 0x400 //
#define RACE_INSECT 0x800 //
#define RACE_THUNDER 0x1000 //
#define RACE_DRAGON 0x2000 //
#define RACE_BEAST 0x4000 //
#define RACE_BEASTWARRIOR 0x8000 //
#define RACE_DINOSAUR 0x10000 //
#define RACE_FISH 0x20000 //
#define RACE_SEASERPENT 0x40000 //
#define RACE_REPTILE 0x80000 //
#define RACE_PSYCHO 0x100000 //
#define RACE_DEVINE 0x200000 //
#define RACE_CREATORGOD 0x400000 //
#define RACE_WYRM 0x800000 //
#define RACE_CYBERSE 0x1000000 //
//Reason
#define REASON_DESTROY 0x1 //
#define REASON_RELEASE 0x2 //
#define REASON_TEMPORARY 0x4 //
#define REASON_MATERIAL 0x8 //
#define REASON_SUMMON 0x10 //
#define REASON_BATTLE 0x20 //
#define REASON_EFFECT 0x40 //
#define REASON_COST 0x80 //
#define REASON_ADJUST 0x100 //
#define REASON_LOST_TARGET 0x200 //
#define REASON_RULE 0x400 //
#define REASON_SPSUMMON 0x800 //
#define REASON_DISSUMMON 0x1000 //
#define REASON_FLIP 0x2000 //
#define REASON_DISCARD 0x4000 //
#define REASON_RDAMAGE 0x8000 //
#define REASON_RRECOVER 0x10000 //
#define REASON_RETURN 0x20000 //
#define REASON_FUSION 0x40000 //
#define REASON_SYNCHRO 0x80000 //
#define REASON_RITUAL 0x100000 //
#define REASON_XYZ 0x200000 //
#define REASON_REPLACE 0x1000000 //
#define REASON_DRAW 0x2000000 //
#define REASON_REDIRECT 0x4000000 //
//#define REASON_REVEAL 0x8000000 //
#define REASON_LINK 0x10000000 //
//Summon Type //Summon Type
#define SUMMON_TYPE_NORMAL 0x10000000 #define SUMMON_TYPE_NORMAL 0x10000000
#define SUMMON_TYPE_ADVANCE 0x11000000 #define SUMMON_TYPE_ADVANCE 0x11000000
...@@ -509,31 +394,6 @@ public: ...@@ -509,31 +394,6 @@ public:
//Counter //Counter
#define COUNTER_WITHOUT_PERMIT 0x1000 #define COUNTER_WITHOUT_PERMIT 0x1000
#define COUNTER_NEED_ENABLE 0x2000 #define COUNTER_NEED_ENABLE 0x2000
//Query list
#define QUERY_CODE 0x1
#define QUERY_POSITION 0x2
#define QUERY_ALIAS 0x4
#define QUERY_TYPE 0x8
#define QUERY_LEVEL 0x10
#define QUERY_RANK 0x20
#define QUERY_ATTRIBUTE 0x40
#define QUERY_RACE 0x80
#define QUERY_ATTACK 0x100
#define QUERY_DEFENSE 0x200
#define QUERY_BASE_ATTACK 0x400
#define QUERY_BASE_DEFENSE 0x800
#define QUERY_REASON 0x1000
#define QUERY_REASON_CARD 0x2000
#define QUERY_EQUIP_CARD 0x4000
#define QUERY_TARGET_CARD 0x8000
#define QUERY_OVERLAY_CARD 0x10000
#define QUERY_COUNTERS 0x20000
#define QUERY_OWNER 0x40000
#define QUERY_IS_DISABLED 0x80000
#define QUERY_IS_PUBLIC 0x100000
#define QUERY_LSCALE 0x200000
#define QUERY_RSCALE 0x400000
#define QUERY_LINK 0x800000
#define ASSUME_CODE 1 #define ASSUME_CODE 1
#define ASSUME_TYPE 2 #define ASSUME_TYPE 2
...@@ -544,13 +404,4 @@ public: ...@@ -544,13 +404,4 @@ public:
#define ASSUME_ATTACK 7 #define ASSUME_ATTACK 7
#define ASSUME_DEFENSE 8 #define ASSUME_DEFENSE 8
#define LINK_MARKER_BOTTOM_LEFT 0001
#define LINK_MARKER_BOTTOM 0002
#define LINK_MARKER_BOTTOM_RIGHT 0004
#define LINK_MARKER_LEFT 0010
#define LINK_MARKER_RIGHT 0040
#define LINK_MARKER_TOP_LEFT 0100
#define LINK_MARKER_TOP 0200
#define LINK_MARKER_TOP_RIGHT 0400
#endif /* CARD_H_ */ #endif /* CARD_H_ */
...@@ -42,4 +42,321 @@ struct card_sort { ...@@ -42,4 +42,321 @@ struct card_sort {
bool operator()(void* const & c1, void* const & c2) const; bool operator()(void* const & c1, void* const & c2) const;
}; };
//Locations
#define LOCATION_DECK 0x01 //
#define LOCATION_HAND 0x02 //
#define LOCATION_MZONE 0x04 //
#define LOCATION_SZONE 0x08 //
#define LOCATION_GRAVE 0x10 //
#define LOCATION_REMOVED 0x20 //
#define LOCATION_EXTRA 0x40 //
#define LOCATION_OVERLAY 0x80 //
#define LOCATION_ONFIELD 0x0c //
#define LOCATION_FZONE 0x100 //
#define LOCATION_PZONE 0x200 //
//Positions
#define POS_FACEUP_ATTACK 0x1
#define POS_FACEDOWN_ATTACK 0x2
#define POS_FACEUP_DEFENSE 0x4
#define POS_FACEDOWN_DEFENSE 0x8
#define POS_FACEUP 0x5
#define POS_FACEDOWN 0xa
#define POS_ATTACK 0x3
#define POS_DEFENSE 0xc
//Flip effect flags
#define NO_FLIP_EFFECT 0x10000
#define FLIP_SET_AVAILABLE 0x20000
//Types
#define TYPE_MONSTER 0x1 //
#define TYPE_SPELL 0x2 //
#define TYPE_TRAP 0x4 //
#define TYPE_NORMAL 0x10 //
#define TYPE_EFFECT 0x20 //
#define TYPE_FUSION 0x40 //
#define TYPE_RITUAL 0x80 //
#define TYPE_TRAPMONSTER 0x100 //
#define TYPE_SPIRIT 0x200 //
#define TYPE_UNION 0x400 //
#define TYPE_DUAL 0x800 //
#define TYPE_TUNER 0x1000 //
#define TYPE_SYNCHRO 0x2000 //
#define TYPE_TOKEN 0x4000 //
#define TYPE_QUICKPLAY 0x10000 //
#define TYPE_CONTINUOUS 0x20000 //
#define TYPE_EQUIP 0x40000 //
#define TYPE_FIELD 0x80000 //
#define TYPE_COUNTER 0x100000 //
#define TYPE_FLIP 0x200000 //
#define TYPE_TOON 0x400000 //
#define TYPE_XYZ 0x800000 //
#define TYPE_PENDULUM 0x1000000 //
#define TYPE_SPSUMMON 0x2000000 //
#define TYPE_LINK 0x4000000 //
//Attributes
#define ATTRIBUTE_EARTH 0x01 //
#define ATTRIBUTE_WATER 0x02 //
#define ATTRIBUTE_FIRE 0x04 //
#define ATTRIBUTE_WIND 0x08 //
#define ATTRIBUTE_LIGHT 0x10 //
#define ATTRIBUTE_DARK 0x20 //
#define ATTRIBUTE_DEVINE 0x40 //
//Races
#define RACE_WARRIOR 0x1 //
#define RACE_SPELLCASTER 0x2 //
#define RACE_FAIRY 0x4 //
#define RACE_FIEND 0x8 //
#define RACE_ZOMBIE 0x10 //
#define RACE_MACHINE 0x20 //
#define RACE_AQUA 0x40 //
#define RACE_PYRO 0x80 //
#define RACE_ROCK 0x100 //
#define RACE_WINDBEAST 0x200 //
#define RACE_PLANT 0x400 //
#define RACE_INSECT 0x800 //
#define RACE_THUNDER 0x1000 //
#define RACE_DRAGON 0x2000 //
#define RACE_BEAST 0x4000 //
#define RACE_BEASTWARRIOR 0x8000 //
#define RACE_DINOSAUR 0x10000 //
#define RACE_FISH 0x20000 //
#define RACE_SEASERPENT 0x40000 //
#define RACE_REPTILE 0x80000 //
#define RACE_PSYCHO 0x100000 //
#define RACE_DEVINE 0x200000 //
#define RACE_CREATORGOD 0x400000 //
#define RACE_WYRM 0x800000 //
#define RACE_CYBERSE 0x1000000 //
//Reason
#define REASON_DESTROY 0x1 //
#define REASON_RELEASE 0x2 //
#define REASON_TEMPORARY 0x4 //
#define REASON_MATERIAL 0x8 //
#define REASON_SUMMON 0x10 //
#define REASON_BATTLE 0x20 //
#define REASON_EFFECT 0x40 //
#define REASON_COST 0x80 //
#define REASON_ADJUST 0x100 //
#define REASON_LOST_TARGET 0x200 //
#define REASON_RULE 0x400 //
#define REASON_SPSUMMON 0x800 //
#define REASON_DISSUMMON 0x1000 //
#define REASON_FLIP 0x2000 //
#define REASON_DISCARD 0x4000 //
#define REASON_RDAMAGE 0x8000 //
#define REASON_RRECOVER 0x10000 //
#define REASON_RETURN 0x20000 //
#define REASON_FUSION 0x40000 //
#define REASON_SYNCHRO 0x80000 //
#define REASON_RITUAL 0x100000 //
#define REASON_XYZ 0x200000 //
#define REASON_REPLACE 0x1000000 //
#define REASON_DRAW 0x2000000 //
#define REASON_REDIRECT 0x4000000 //
//#define REASON_REVEAL 0x8000000 //
#define REASON_LINK 0x10000000 //
//Query list
#define QUERY_CODE 0x1
#define QUERY_POSITION 0x2
#define QUERY_ALIAS 0x4
#define QUERY_TYPE 0x8
#define QUERY_LEVEL 0x10
#define QUERY_RANK 0x20
#define QUERY_ATTRIBUTE 0x40
#define QUERY_RACE 0x80
#define QUERY_ATTACK 0x100
#define QUERY_DEFENSE 0x200
#define QUERY_BASE_ATTACK 0x400
#define QUERY_BASE_DEFENSE 0x800
#define QUERY_REASON 0x1000
#define QUERY_REASON_CARD 0x2000
#define QUERY_EQUIP_CARD 0x4000
#define QUERY_TARGET_CARD 0x8000
#define QUERY_OVERLAY_CARD 0x10000
#define QUERY_COUNTERS 0x20000
#define QUERY_OWNER 0x40000
#define QUERY_IS_DISABLED 0x80000
#define QUERY_IS_PUBLIC 0x100000
#define QUERY_LSCALE 0x200000
#define QUERY_RSCALE 0x400000
#define QUERY_LINK 0x800000
//Link markers
#define LINK_MARKER_BOTTOM_LEFT 0001
#define LINK_MARKER_BOTTOM 0002
#define LINK_MARKER_BOTTOM_RIGHT 0004
#define LINK_MARKER_LEFT 0010
#define LINK_MARKER_RIGHT 0040
#define LINK_MARKER_TOP_LEFT 0100
#define LINK_MARKER_TOP 0200
#define LINK_MARKER_TOP_RIGHT 0400
//Messages
#define MSG_RETRY 1
#define MSG_HINT 2
#define MSG_WAITING 3
#define MSG_START 4
#define MSG_WIN 5
#define MSG_UPDATE_DATA 6
#define MSG_UPDATE_CARD 7
#define MSG_REQUEST_DECK 8
#define MSG_SELECT_BATTLECMD 10
#define MSG_SELECT_IDLECMD 11
#define MSG_SELECT_EFFECTYN 12
#define MSG_SELECT_YESNO 13
#define MSG_SELECT_OPTION 14
#define MSG_SELECT_CARD 15
#define MSG_SELECT_CHAIN 16
#define MSG_SELECT_PLACE 18
#define MSG_SELECT_POSITION 19
#define MSG_SELECT_TRIBUTE 20
#define MSG_SORT_CHAIN 21
#define MSG_SELECT_COUNTER 22
#define MSG_SELECT_SUM 23
#define MSG_SELECT_DISFIELD 24
#define MSG_SORT_CARD 25
#define MSG_SELECT_UNSELECT_CARD 26
#define MSG_CONFIRM_DECKTOP 30
#define MSG_CONFIRM_CARDS 31
#define MSG_SHUFFLE_DECK 32
#define MSG_SHUFFLE_HAND 33
#define MSG_REFRESH_DECK 34
#define MSG_SWAP_GRAVE_DECK 35
#define MSG_SHUFFLE_SET_CARD 36
#define MSG_REVERSE_DECK 37
#define MSG_DECK_TOP 38
#define MSG_SHUFFLE_EXTRA 39
#define MSG_NEW_TURN 40
#define MSG_NEW_PHASE 41
#define MSG_CONFIRM_EXTRATOP 42
#define MSG_MOVE 50
#define MSG_POS_CHANGE 53
#define MSG_SET 54
#define MSG_SWAP 55
#define MSG_FIELD_DISABLED 56
#define MSG_SUMMONING 60
#define MSG_SUMMONED 61
#define MSG_SPSUMMONING 62
#define MSG_SPSUMMONED 63
#define MSG_FLIPSUMMONING 64
#define MSG_FLIPSUMMONED 65
#define MSG_CHAINING 70
#define MSG_CHAINED 71
#define MSG_CHAIN_SOLVING 72
#define MSG_CHAIN_SOLVED 73
#define MSG_CHAIN_END 74
#define MSG_CHAIN_NEGATED 75
#define MSG_CHAIN_DISABLED 76
#define MSG_CARD_SELECTED 80
#define MSG_RANDOM_SELECTED 81
#define MSG_BECOME_TARGET 83
#define MSG_DRAW 90
#define MSG_DAMAGE 91
#define MSG_RECOVER 92
#define MSG_EQUIP 93
#define MSG_LPUPDATE 94
#define MSG_UNEQUIP 95
#define MSG_CARD_TARGET 96
#define MSG_CANCEL_TARGET 97
#define MSG_PAY_LPCOST 100
#define MSG_ADD_COUNTER 101
#define MSG_REMOVE_COUNTER 102
#define MSG_ATTACK 110
#define MSG_BATTLE 111
#define MSG_ATTACK_DISABLED 112
#define MSG_DAMAGE_STEP_START 113
#define MSG_DAMAGE_STEP_END 114
#define MSG_MISSED_EFFECT 120
#define MSG_BE_CHAIN_TARGET 121
#define MSG_CREATE_RELATION 122
#define MSG_RELEASE_RELATION 123
#define MSG_TOSS_COIN 130
#define MSG_TOSS_DICE 131
#define MSG_ROCK_PAPER_SCISSORS 132
#define MSG_HAND_RES 133
#define MSG_ANNOUNCE_RACE 140
#define MSG_ANNOUNCE_ATTRIB 141
#define MSG_ANNOUNCE_CARD 142
#define MSG_ANNOUNCE_NUMBER 143
#define MSG_ANNOUNCE_CARD_FILTER 144
#define MSG_CARD_HINT 160
#define MSG_TAG_SWAP 161
#define MSG_RELOAD_FIELD 162 // Debug.ReloadFieldEnd()
#define MSG_AI_NAME 163
#define MSG_SHOW_HINT 164
#define MSG_PLAYER_HINT 165
#define MSG_MATCH_KILL 170
#define MSG_CUSTOM_MSG 180
//Hints
#define HINT_EVENT 1
#define HINT_MESSAGE 2
#define HINT_SELECTMSG 3
#define HINT_OPSELECTED 4
#define HINT_EFFECT 5
#define HINT_RACE 6
#define HINT_ATTRIB 7
#define HINT_CODE 8
#define HINT_NUMBER 9
#define HINT_CARD 10
//
#define CHINT_TURN 1
#define CHINT_CARD 2
#define CHINT_RACE 3
#define CHINT_ATTRIBUTE 4
#define CHINT_NUMBER 5
#define CHINT_DESC_ADD 6
#define CHINT_DESC_REMOVE 7
//
#define PHINT_DESC_ADD 6
#define PHINT_DESC_REMOVE 7
//
#define EDESC_OPERATION 1
#define EDESC_RESET 2
//
#define OPCODE_ADD 0x40000000
#define OPCODE_SUB 0x40000001
#define OPCODE_MUL 0x40000002
#define OPCODE_DIV 0x40000003
#define OPCODE_AND 0x40000004
#define OPCODE_OR 0x40000005
#define OPCODE_NEG 0x40000006
#define OPCODE_NOT 0x40000007
#define OPCODE_ISCODE 0x40000100
#define OPCODE_ISSETCARD 0x40000101
#define OPCODE_ISTYPE 0x40000102
#define OPCODE_ISRACE 0x40000103
#define OPCODE_ISATTRIBUTE 0x40000104
//Player
#define PLAYER_NONE 2 //
#define PLAYER_ALL 3 //
//Phase
#define PHASE_DRAW 0x01
#define PHASE_STANDBY 0x02
#define PHASE_MAIN1 0x04
#define PHASE_BATTLE_START 0x08
#define PHASE_BATTLE_STEP 0x10
#define PHASE_DAMAGE 0x20
#define PHASE_DAMAGE_CAL 0x40
#define PHASE_BATTLE 0x80
#define PHASE_MAIN2 0x100
#define PHASE_END 0x200
//Options
#define DUEL_TEST_MODE 0x01
#define DUEL_ATTACK_FIRST_TURN 0x02
//#define DUEL_NO_CHAIN_HINT 0x04
#define DUEL_OBSOLETE_RULING 0x08
#define DUEL_PSEUDO_SHUFFLE 0x10
#define DUEL_TAG_MODE 0x20
#define DUEL_SIMPLE_AI 0x40
#endif /* COMMON_H_ */ #endif /* COMMON_H_ */
...@@ -62,26 +62,4 @@ private: ...@@ -62,26 +62,4 @@ private:
group* register_group(group* pgroup); group* register_group(group* pgroup);
}; };
//Player
#define PLAYER_NONE 2 //
#define PLAYER_ALL 3 //
//Phase
#define PHASE_DRAW 0x01
#define PHASE_STANDBY 0x02
#define PHASE_MAIN1 0x04
#define PHASE_BATTLE_START 0x08
#define PHASE_BATTLE_STEP 0x10
#define PHASE_DAMAGE 0x20
#define PHASE_DAMAGE_CAL 0x40
#define PHASE_BATTLE 0x80
#define PHASE_MAIN2 0x100
#define PHASE_END 0x200
//Options
#define DUEL_TEST_MODE 0x01
#define DUEL_ATTACK_FIRST_TURN 0x02
//#define DUEL_NO_CHAIN_HINT 0x04
#define DUEL_OBSOLETE_RULING 0x08
#define DUEL_PSEUDO_SHUFFLE 0x10
#define DUEL_TAG_MODE 0x20
#define DUEL_SIMPLE_AI 0x40
#endif /* DUEL_H_ */ #endif /* DUEL_H_ */
...@@ -345,6 +345,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -345,6 +345,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_CANNOT_M2 186 #define EFFECT_CANNOT_M2 186
#define EFFECT_CANNOT_EP 187 #define EFFECT_CANNOT_EP 187
#define EFFECT_SKIP_TURN 188 #define EFFECT_SKIP_TURN 188
#define EFFECT_SKIP_EP 189
#define EFFECT_DEFENSE_ATTACK 190 #define EFFECT_DEFENSE_ATTACK 190
#define EFFECT_MUST_ATTACK 191 #define EFFECT_MUST_ATTACK 191
#define EFFECT_FIRST_ATTACK 192 #define EFFECT_FIRST_ATTACK 192
......
...@@ -779,140 +779,4 @@ public: ...@@ -779,140 +779,4 @@ public:
#define PROCESSOR_REMOVEOL_S 160 #define PROCESSOR_REMOVEOL_S 160
#define PROCESSOR_MOVETOFIELD_S 161 #define PROCESSOR_MOVETOFIELD_S 161
//Hints
#define HINT_EVENT 1
#define HINT_MESSAGE 2
#define HINT_SELECTMSG 3
#define HINT_OPSELECTED 4
#define HINT_EFFECT 5
#define HINT_RACE 6
#define HINT_ATTRIB 7
#define HINT_CODE 8
#define HINT_NUMBER 9
#define HINT_CARD 10
//
#define CHINT_TURN 1
#define CHINT_CARD 2
#define CHINT_RACE 3
#define CHINT_ATTRIBUTE 4
#define CHINT_NUMBER 5
#define CHINT_DESC_ADD 6
#define CHINT_DESC_REMOVE 7
//
#define PHINT_DESC_ADD 6
#define PHINT_DESC_REMOVE 7
//
#define EDESC_OPERATION 1
#define EDESC_RESET 2
//
#define OPCODE_ADD 0x40000000
#define OPCODE_SUB 0x40000001
#define OPCODE_MUL 0x40000002
#define OPCODE_DIV 0x40000003
#define OPCODE_AND 0x40000004
#define OPCODE_OR 0x40000005
#define OPCODE_NEG 0x40000006
#define OPCODE_NOT 0x40000007
#define OPCODE_ISCODE 0x40000100
#define OPCODE_ISSETCARD 0x40000101
#define OPCODE_ISTYPE 0x40000102
#define OPCODE_ISRACE 0x40000103
#define OPCODE_ISATTRIBUTE 0x40000104
//Messages
#define MSG_RETRY 1
#define MSG_HINT 2
#define MSG_WAITING 3
#define MSG_START 4
#define MSG_WIN 5
#define MSG_UPDATE_DATA 6
#define MSG_UPDATE_CARD 7
#define MSG_REQUEST_DECK 8
#define MSG_SELECT_BATTLECMD 10
#define MSG_SELECT_IDLECMD 11
#define MSG_SELECT_EFFECTYN 12
#define MSG_SELECT_YESNO 13
#define MSG_SELECT_OPTION 14
#define MSG_SELECT_CARD 15
#define MSG_SELECT_CHAIN 16
#define MSG_SELECT_PLACE 18
#define MSG_SELECT_POSITION 19
#define MSG_SELECT_TRIBUTE 20
#define MSG_SORT_CHAIN 21
#define MSG_SELECT_COUNTER 22
#define MSG_SELECT_SUM 23
#define MSG_SELECT_DISFIELD 24
#define MSG_SORT_CARD 25
#define MSG_SELECT_UNSELECT_CARD 26
#define MSG_CONFIRM_DECKTOP 30
#define MSG_CONFIRM_CARDS 31
#define MSG_SHUFFLE_DECK 32
#define MSG_SHUFFLE_HAND 33
#define MSG_REFRESH_DECK 34
#define MSG_SWAP_GRAVE_DECK 35
#define MSG_SHUFFLE_SET_CARD 36
#define MSG_REVERSE_DECK 37
#define MSG_DECK_TOP 38
#define MSG_SHUFFLE_EXTRA 39
#define MSG_NEW_TURN 40
#define MSG_NEW_PHASE 41
#define MSG_CONFIRM_EXTRATOP 42
#define MSG_MOVE 50
#define MSG_POS_CHANGE 53
#define MSG_SET 54
#define MSG_SWAP 55
#define MSG_FIELD_DISABLED 56
#define MSG_SUMMONING 60
#define MSG_SUMMONED 61
#define MSG_SPSUMMONING 62
#define MSG_SPSUMMONED 63
#define MSG_FLIPSUMMONING 64
#define MSG_FLIPSUMMONED 65
#define MSG_CHAINING 70
#define MSG_CHAINED 71
#define MSG_CHAIN_SOLVING 72
#define MSG_CHAIN_SOLVED 73
#define MSG_CHAIN_END 74
#define MSG_CHAIN_NEGATED 75
#define MSG_CHAIN_DISABLED 76
#define MSG_CARD_SELECTED 80
#define MSG_RANDOM_SELECTED 81
#define MSG_BECOME_TARGET 83
#define MSG_DRAW 90
#define MSG_DAMAGE 91
#define MSG_RECOVER 92
#define MSG_EQUIP 93
#define MSG_LPUPDATE 94
#define MSG_UNEQUIP 95
#define MSG_CARD_TARGET 96
#define MSG_CANCEL_TARGET 97
#define MSG_PAY_LPCOST 100
#define MSG_ADD_COUNTER 101
#define MSG_REMOVE_COUNTER 102
#define MSG_ATTACK 110
#define MSG_BATTLE 111
#define MSG_ATTACK_DISABLED 112
#define MSG_DAMAGE_STEP_START 113
#define MSG_DAMAGE_STEP_END 114
#define MSG_MISSED_EFFECT 120
#define MSG_BE_CHAIN_TARGET 121
#define MSG_CREATE_RELATION 122
#define MSG_RELEASE_RELATION 123
#define MSG_TOSS_COIN 130
#define MSG_TOSS_DICE 131
#define MSG_ROCK_PAPER_SCISSORS 132
#define MSG_HAND_RES 133
#define MSG_ANNOUNCE_RACE 140
#define MSG_ANNOUNCE_ATTRIB 141
#define MSG_ANNOUNCE_CARD 142
#define MSG_ANNOUNCE_NUMBER 143
#define MSG_ANNOUNCE_CARD_FILTER 144
#define MSG_CARD_HINT 160
#define MSG_TAG_SWAP 161
#define MSG_RELOAD_FIELD 162 // Debug.ReloadFieldEnd()
#define MSG_AI_NAME 163
#define MSG_SHOW_HINT 164
#define MSG_PLAYER_HINT 165
#define MSG_MATCH_KILL 170
#define MSG_CUSTOM_MSG 180
#endif /* FIELD_H_ */ #endif /* FIELD_H_ */
...@@ -205,8 +205,6 @@ static const struct luaL_Reg cardlib[] = { ...@@ -205,8 +205,6 @@ static const struct luaL_Reg cardlib[] = {
{ "IsAbleToDeckOrExtraAsCost", scriptlib::card_is_able_to_deck_or_extra_as_cost }, { "IsAbleToDeckOrExtraAsCost", scriptlib::card_is_able_to_deck_or_extra_as_cost },
{ "IsAbleToGraveAsCost", scriptlib::card_is_able_to_grave_as_cost }, { "IsAbleToGraveAsCost", scriptlib::card_is_able_to_grave_as_cost },
{ "IsAbleToRemoveAsCost", scriptlib::card_is_able_to_remove_as_cost }, { "IsAbleToRemoveAsCost", scriptlib::card_is_able_to_remove_as_cost },
{ "IsAbleToDecreaseAttackAsCost", scriptlib::card_is_able_to_decrease_attack_as_cost },
{ "IsAbleToDecreaseDefenseAsCost", scriptlib::card_is_able_to_decrease_defense_as_cost },
{ "IsReleasable", scriptlib::card_is_releasable }, { "IsReleasable", scriptlib::card_is_releasable },
{ "IsReleasableByEffect", scriptlib::card_is_releasable_by_effect }, { "IsReleasableByEffect", scriptlib::card_is_releasable_by_effect },
{ "IsDiscardable", scriptlib::card_is_discardable }, { "IsDiscardable", scriptlib::card_is_discardable },
......
...@@ -2112,34 +2112,6 @@ int32 scriptlib::card_is_able_to_remove_as_cost(lua_State *L) { ...@@ -2112,34 +2112,6 @@ int32 scriptlib::card_is_able_to_remove_as_cost(lua_State *L) {
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
return 1; return 1;
} }
int32 scriptlib::card_is_able_to_decrease_attack_as_cost(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 p = pcard->pduel->game_field->core.reason_player;
int32 val = 0;
if(lua_gettop(L) > 1)
val = lua_tointeger(L, 2);
if(pcard->is_attack_decreasable_as_cost(p, val))
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_is_able_to_decrease_defense_as_cost(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 p = pcard->pduel->game_field->core.reason_player;
int32 val = 0;
if(lua_gettop(L) > 1)
val = lua_tointeger(L, 2);
if(pcard->is_defense_decreasable_as_cost(p, val))
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::card_is_releasable(lua_State *L) { int32 scriptlib::card_is_releasable(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
......
...@@ -1986,6 +1986,8 @@ int32 scriptlib::duel_skip_phase(lua_State *L) { ...@@ -1986,6 +1986,8 @@ int32 scriptlib::duel_skip_phase(lua_State *L) {
code = EFFECT_SKIP_BP; code = EFFECT_SKIP_BP;
else if(phase == PHASE_MAIN2) else if(phase == PHASE_MAIN2)
code = EFFECT_SKIP_M2; code = EFFECT_SKIP_M2;
else if(phase == PHASE_END)
code = EFFECT_SKIP_EP;
else else
return 0; return 0;
effect* peffect = pduel->new_effect(); effect* peffect = pduel->new_effect();
......
...@@ -1365,8 +1365,10 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1365,8 +1365,10 @@ int32 field::process_phase_event(int16 step, int32 phase) {
switch(step) { switch(step) {
case 0: { case 0: {
if((phase == PHASE_DRAW && is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_DP)) if((phase == PHASE_DRAW && is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_DP))
|| (phase == PHASE_STANDBY && is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_SP)) || (phase == PHASE_STANDBY && is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_SP))
|| (phase == PHASE_BATTLE_START && is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_BP))) { || (phase == PHASE_BATTLE_START && is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_BP))
|| (phase == PHASE_BATTLE && is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_BP))
|| (phase == PHASE_END && is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_EP))) {
core.units.begin()->step = 24; core.units.begin()->step = 24;
return FALSE; return FALSE;
} }
...@@ -4198,6 +4200,12 @@ int32 field::process_turn(uint16 step, uint8 turn_player) { ...@@ -4198,6 +4200,12 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
//End Phase //End Phase
infos.phase = PHASE_END; infos.phase = PHASE_END;
core.phase_action = FALSE; core.phase_action = FALSE;
if(is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_EP)) {
core.units.begin()->step = 17;
reset_phase(PHASE_END);
adjust_all();
return FALSE;
}
pduel->write_buffer8(MSG_NEW_PHASE); pduel->write_buffer8(MSG_NEW_PHASE);
pduel->write_buffer16(infos.phase); pduel->write_buffer16(infos.phase);
raise_event((card*)0, EVENT_PHASE_START + PHASE_END, 0, 0, 0, turn_player, 0); raise_event((card*)0, EVENT_PHASE_START + PHASE_END, 0, 0, 0, turn_player, 0);
......
...@@ -207,8 +207,6 @@ public: ...@@ -207,8 +207,6 @@ public:
static int32 card_is_able_to_extra_as_cost(lua_State *L); static int32 card_is_able_to_extra_as_cost(lua_State *L);
static int32 card_is_able_to_deck_or_extra_as_cost(lua_State *L); static int32 card_is_able_to_deck_or_extra_as_cost(lua_State *L);
static int32 card_is_able_to_remove_as_cost(lua_State *L); static int32 card_is_able_to_remove_as_cost(lua_State *L);
static int32 card_is_able_to_decrease_attack_as_cost(lua_State *L);
static int32 card_is_able_to_decrease_defense_as_cost(lua_State *L);
static int32 card_is_releasable(lua_State *L); static int32 card_is_releasable(lua_State *L);
static int32 card_is_releasable_by_effect(lua_State *L); static int32 card_is_releasable_by_effect(lua_State *L);
static int32 card_is_discardable(lua_State *L); static int32 card_is_discardable(lua_State *L);
......
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