Commit ce6a9654 authored by salix5's avatar salix5

atk/attr/race

My opinion:
1. text attack/original attribute/original race
These values should be loaded from cards.cdb
2. trap monsters
cards.cdb should keep the attribute/race of trap monsters,
so EFFECT_CHANGE_ATTRIBUTE in card_add_trap_monster_attribute() is not needed.
2. get_attack(),get_attribute(),get_race()
Now we can get the values of cards in LOCATION_SZONE,
so trap monsters can work well with all kinds of EFFECT_CANNOT_SPECIAL_SUMMON
parent 7d49b697
......@@ -328,7 +328,7 @@ int32 card::get_base_attack(uint8 swap) {
int32 card::get_attack(uint8 swap) {
if(assume_type == ASSUME_ATTACK)
return assume_value;
if (current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER))
if (!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER))
return 0;
if (current.location != LOCATION_MZONE)
return data.attack;
......@@ -428,7 +428,7 @@ int32 card::get_base_defence(uint8 swap) {
int32 card::get_defence(uint8 swap) {
if(assume_type == ASSUME_DEFENCE)
return assume_value;
if (current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER))
if (!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER))
return 0;
if (current.location != LOCATION_MZONE)
return data.defence;
......@@ -500,7 +500,7 @@ int32 card::get_defence(uint8 swap) {
return def;
}
uint32 card::get_level() {
if((data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL) || (current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER)))
if((data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL) || (!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER)))
return 0;
if(assume_type == ASSUME_LEVEL)
return assume_value;
......@@ -618,9 +618,9 @@ uint32 card::get_base_attribute() {
uint32 card::get_attribute() {
if(assume_type == ASSUME_ATTRIBUTE)
return assume_value;
if(current.location != LOCATION_MZONE && !(get_type() & TYPE_MONSTER))
if(!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER))
return 0;
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)) && !(get_type() & TYPE_TRAPMONSTER))
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)))
return data.attribute;
if (temp.attribute != 0xffffffff)
return temp.attribute;
......@@ -653,9 +653,9 @@ uint32 card::get_base_race() {
uint32 card::get_race() {
if(assume_type == ASSUME_RACE)
return assume_value;
if(current.location != LOCATION_MZONE && !(get_type() & TYPE_MONSTER))
if(!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER))
return 0;
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)) && !(get_type() & TYPE_TRAPMONSTER))
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)))
return data.race;
if (temp.race != 0xffffffff)
return temp.race;
......
......@@ -149,7 +149,7 @@ int32 scriptlib::card_get_origin_attribute(lua_State *L) {
if(pcard->status & STATUS_NO_LEVEL)
lua_pushinteger(L, 0);
else
lua_pushinteger(L, pcard->get_base_attribute());
lua_pushinteger(L, pcard->data.attribute);
return 1;
}
int32 scriptlib::card_get_race(lua_State *L) {
......@@ -166,7 +166,7 @@ int32 scriptlib::card_get_origin_race(lua_State *L) {
if(pcard->status & STATUS_NO_LEVEL)
lua_pushinteger(L, 0);
else
lua_pushinteger(L, pcard->get_base_race());
lua_pushinteger(L, pcard->data.race);
return 1;
}
int32 scriptlib::card_get_attack(lua_State *L) {
......@@ -1524,7 +1524,7 @@ int32 scriptlib::card_is_level_below(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 lvl = lua_tointeger(L, 2);
if((pcard->data.type & TYPE_XYZ) || (pcard->status & STATUS_NO_LEVEL)
|| (!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE)))
|| (!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD)))
lua_pushboolean(L, 0);
else
lua_pushboolean(L, pcard->get_level() <= lvl);
......@@ -1536,7 +1536,7 @@ int32 scriptlib::card_is_level_above(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 lvl = lua_tointeger(L, 2);
if((pcard->data.type & TYPE_XYZ) || (pcard->status & STATUS_NO_LEVEL)
|| (!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE)))
|| (!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD)))
lua_pushboolean(L, 0);
else
lua_pushboolean(L, pcard->get_level() >= lvl);
......@@ -1571,7 +1571,7 @@ int32 scriptlib::card_is_attack_below(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
int32 atk = lua_tointeger(L, 2);
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE))
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD))
lua_pushboolean(L, 0);
else {
int _atk = pcard->get_attack();
......@@ -1584,7 +1584,7 @@ int32 scriptlib::card_is_attack_above(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
int32 atk = lua_tointeger(L, 2);
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE))
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD))
lua_pushboolean(L, 0);
else {
int _atk = pcard->get_attack();
......@@ -1597,7 +1597,7 @@ int32 scriptlib::card_is_defence_below(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
int32 def = lua_tointeger(L, 2);
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE))
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD))
lua_pushboolean(L, 0);
else {
int _def = pcard->get_defence();
......@@ -1610,7 +1610,7 @@ int32 scriptlib::card_is_defence_above(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
int32 def = lua_tointeger(L, 2);
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE))
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD))
lua_pushboolean(L, 0);
else {
int _def = pcard->get_defence();
......@@ -1877,10 +1877,10 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) {
peffect->value = TYPE_MONSTER | TYPE_TRAPMONSTER | extra_type;
pcard->add_effect(peffect);
//attribute
peffect = pduel->new_effect();
/*peffect = pduel->new_effect();
peffect->owner = pcard;
peffect->type = EFFECT_TYPE_SINGLE;
peffect->code = EFFECT_CHANGE_BASE_ATTRIBUTE;
peffect->code = EFFECT_CHANGE_ATTRIBUTE;
peffect->flag = EFFECT_FLAG_CANNOT_DISABLE;
peffect->reset_flag = RESET_EVENT + 0x47e0000;
peffect->value = attribute;
......@@ -1889,11 +1889,11 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) {
peffect = pduel->new_effect();
peffect->owner = pcard;
peffect->type = EFFECT_TYPE_SINGLE;
peffect->code = EFFECT_CHANGE_BASE_RACE;
peffect->code = EFFECT_CHANGE_RACE;
peffect->flag = EFFECT_FLAG_CANNOT_DISABLE;
peffect->reset_flag = RESET_EVENT + 0x47e0000;
peffect->value = race;
pcard->add_effect(peffect);
pcard->add_effect(peffect);*/
//level
peffect = pduel->new_effect();
peffect->owner = pcard;
......
......@@ -67,14 +67,6 @@ function c77462146.spop(e,tp,eg,ep,ev,re,r,rp)
e1:SetValue(TYPE_NORMAL+TYPE_MONSTER)
e1:SetReset(RESET_EVENT+0x47c0000)
c:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_CHANGE_RACE)
e2:SetValue(RACE_WARRIOR)
c:RegisterEffect(e2,true)
local e3=e1:Clone()
e3:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e3:SetValue(ATTRIBUTE_DARK)
c:RegisterEffect(e3,true)
local e4=e1:Clone()
e4:SetCode(EFFECT_CHANGE_LEVEL)
e4:SetValue(4)
......
......@@ -54,12 +54,12 @@ function c81210420.activate(e,tp,eg,ep,ev,re,r,rp)
e1:SetReset(RESET_EVENT+0x47c0000)
tg:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_CHANGE_RACE)
e2:SetValue(0)
e2:SetCode(EFFECT_REMOVE_RACE)
e2:SetValue(RACE_ALL)
tg:RegisterEffect(e2,true)
local e3=e1:Clone()
e3:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e3:SetValue(0)
e3:SetCode(EFFECT_REMOVE_ATTRIBUTE)
e3:SetValue(0xff)
tg:RegisterEffect(e3,true)
local e4=e1:Clone()
e4:SetCode(EFFECT_SET_BASE_ATTACK)
......
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