-
Notifications
You must be signed in to change notification settings - Fork 31
/
effect.h
121 lines (115 loc) · 4.02 KB
/
effect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
* Copyright (c) 2010-2015, Argon Sun (Fluorohydride)
* Copyright (c) 2016-2024, Edoardo Lolletti (edo9300) <[email protected]>
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#ifndef EFFECT_H_
#define EFFECT_H_
#include <lua.h> //lua_Integer
#include <vector>
#include "common.h"
#include "effect_constants.h"
#include "lua_obj.h"
class card;
class duel;
class group;
struct chain;
struct tevent;
enum effect_flag : uint32_t;
enum effect_flag2 : uint32_t;
class effect : public lua_obj_helper<LuaParam::EFFECT> {
public:
uint8_t count_limit{};
uint8_t count_limit_max{};
uint8_t count_flag{};
uint8_t count_hopt_index{};
uint8_t effect_owner{ PLAYER_NONE };
uint16_t type{};
uint16_t copy_id{};
uint16_t range{};
uint16_t s_range{};
uint16_t o_range{};
uint16_t reset_count{};
uint16_t active_location{};
uint16_t active_sequence{};
uint16_t status{};
uint32_t code{};
uint32_t flag[2]{};
uint32_t id{};
uint32_t initial_id{};
uint32_t reset_flag{};
uint32_t count_code{};
uint32_t category{};
uint32_t hint_timing[2]{};
uint32_t card_type{};
uint32_t active_type{};
int32_t label_object{};
int32_t condition{};
int32_t cost{};
int32_t target{};
int32_t value{};
int32_t operation{};
card* owner{ nullptr };
card* handler{ nullptr };
card* active_handler{};
uint64_t description{};
std::vector<lua_Integer> label;
explicit effect(duel* pd) : lua_obj_helper(pd) {}
int32_t is_disable_related();
int32_t is_self_destroy_related();
int32_t is_can_be_forbidden();
int32_t is_available();
int32_t check_count_limit(uint8_t playerid) const;
int32_t has_count_limit() const {
return is_flag(EFFECT_FLAG_COUNT_LIMIT);
}
int32_t is_activateable(uint8_t playerid, const tevent& e, int32_t neglect_cond = FALSE, int32_t neglect_cost = FALSE, int32_t neglect_target = FALSE, int32_t neglect_loc = FALSE, int32_t neglect_faceup = FALSE);
int32_t is_action_check(uint8_t playerid);
int32_t is_activate_ready(effect* reason_effect, uint8_t playerid, const tevent& e, int32_t neglect_cond = FALSE, int32_t neglect_cost = FALSE, int32_t neglect_target = FALSE);
int32_t is_activate_ready(uint8_t playerid, const tevent& e, int32_t neglect_cond = FALSE, int32_t neglect_cost = FALSE, int32_t neglect_target = FALSE);
int32_t is_condition_check(uint8_t playerid, const tevent& e);
int32_t is_activate_check(uint8_t playerid, const tevent& e, int32_t neglect_cond = FALSE, int32_t neglect_cost = FALSE, int32_t neglect_target = FALSE);
int32_t is_target(card* pcard);
int32_t is_fit_target_function(card* pcard);
int32_t is_target_player(uint8_t playerid);
int32_t is_player_effect_target(card* pcard);
int32_t is_immuned(card* pcard);
int32_t is_chainable(uint8_t tp);
int32_t reset(uint32_t reset_level, uint32_t reset_type);
void dec_count(uint32_t playerid = 2);
void inc_count(uint32_t playerid = 2);
void recharge();
uint8_t get_client_mode() const;
bool has_function_value() const {
return is_flag(EFFECT_FLAG_FUNC_VALUE);
}
lua_Integer get_value(uint32_t extraargs = 0);
lua_Integer get_value(card* pcard, uint32_t extraargs = 0);
lua_Integer get_value(effect* peffect, uint32_t extraargs = 0);
void get_value(uint32_t extraargs, std::vector<lua_Integer>& result);
void get_value(card* pcard, uint32_t extraargs, std::vector<lua_Integer>& result);
void get_value(effect* peffect, uint32_t extraargs, std::vector<lua_Integer>& result);
int32_t check_value_condition(uint32_t extraargs = 0);
void* get_label_object();
int32_t get_speed();
effect* clone(int32_t majestic = FALSE);
card* get_real_handler() const;
card* get_owner() const;
uint8_t get_owner_player();
card* get_handler() const;
uint8_t get_handler_player();
int32_t in_range(card* pcard);
int32_t is_in_range_of_symbolic_mzone(card* pcard);
int32_t in_range(const chain& ch);
void set_activate_location();
void set_active_type();
uint32_t get_active_type();
bool is_flag(effect_flag flag_to_check) const {
return !!(flag[0] & flag_to_check);
}
bool is_flag(effect_flag2 flag_to_check) const {
return !!(flag[1] & flag_to_check);
}
};
#endif /* EFFECT_H_ */