Commit 16d3d6f9 authored by mercury233's avatar mercury233 Committed by GitHub

update Card.GetAttack and so on (#237)

parent 3b8bde1f
...@@ -584,14 +584,20 @@ int32 scriptlib::card_get_attack(lua_State *L) { ...@@ -584,14 +584,20 @@ int32 scriptlib::card_get_attack(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);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->get_attack()); int32 atk = pcard->get_attack();
if(atk < 0)
atk = 0;
lua_pushinteger(L, atk);
return 1; return 1;
} }
int32 scriptlib::card_get_origin_attack(lua_State *L) { int32 scriptlib::card_get_origin_attack(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);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->get_base_attack()); int32 atk = pcard->get_base_attack();
if(atk < 0)
atk = 0;
lua_pushinteger(L, atk);
return 1; return 1;
} }
int32 scriptlib::card_get_text_attack(lua_State *L) { int32 scriptlib::card_get_text_attack(lua_State *L) {
...@@ -608,14 +614,20 @@ int32 scriptlib::card_get_defense(lua_State *L) { ...@@ -608,14 +614,20 @@ int32 scriptlib::card_get_defense(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);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->get_defense()); int32 def = pcard->get_defense();
if(def < 0)
def = 0;
lua_pushinteger(L, def);
return 1; return 1;
} }
int32 scriptlib::card_get_origin_defense(lua_State *L) { int32 scriptlib::card_get_origin_defense(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);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->get_base_defense()); int32 def = pcard->get_base_defense();
if(def < 0)
def = 0;
lua_pushinteger(L, def);
return 1; return 1;
} }
int32 scriptlib::card_get_text_defense(lua_State *L) { int32 scriptlib::card_get_text_defense(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