Commit 86c44bbb authored by salix5's avatar salix5
parent ce6a9654
...@@ -328,7 +328,7 @@ int32 card::get_base_attack(uint8 swap) { ...@@ -328,7 +328,7 @@ int32 card::get_base_attack(uint8 swap) {
int32 card::get_attack(uint8 swap) { int32 card::get_attack(uint8 swap) {
if(assume_type == ASSUME_ATTACK) if(assume_type == ASSUME_ATTACK)
return assume_value; return assume_value;
if (!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER)) if (current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER) && !(get_type() & TYPE_MONSTER))
return 0; return 0;
if (current.location != LOCATION_MZONE) if (current.location != LOCATION_MZONE)
return data.attack; return data.attack;
...@@ -428,7 +428,7 @@ int32 card::get_base_defence(uint8 swap) { ...@@ -428,7 +428,7 @@ int32 card::get_base_defence(uint8 swap) {
int32 card::get_defence(uint8 swap) { int32 card::get_defence(uint8 swap) {
if(assume_type == ASSUME_DEFENCE) if(assume_type == ASSUME_DEFENCE)
return assume_value; return assume_value;
if (!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER)) if (current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER) && !(get_type() & TYPE_MONSTER))
return 0; return 0;
if (current.location != LOCATION_MZONE) if (current.location != LOCATION_MZONE)
return data.defence; return data.defence;
...@@ -500,7 +500,8 @@ int32 card::get_defence(uint8 swap) { ...@@ -500,7 +500,8 @@ int32 card::get_defence(uint8 swap) {
return def; return def;
} }
uint32 card::get_level() { uint32 card::get_level() {
if((data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL) || (!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER))) if((data.type & TYPE_XYZ) || (status & STATUS_NO_LEVEL)
|| (current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER) && !(get_type() & TYPE_MONSTER)))
return 0; return 0;
if(assume_type == ASSUME_LEVEL) if(assume_type == ASSUME_LEVEL)
return assume_value; return assume_value;
...@@ -618,25 +619,28 @@ uint32 card::get_base_attribute() { ...@@ -618,25 +619,28 @@ uint32 card::get_base_attribute() {
uint32 card::get_attribute() { uint32 card::get_attribute() {
if(assume_type == ASSUME_ATTRIBUTE) if(assume_type == ASSUME_ATTRIBUTE)
return assume_value; return assume_value;
if(!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER)) if(current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER) && !(get_type() & TYPE_MONSTER))
return 0; return 0;
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE))) if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)))
return data.attribute; return data.attribute;
if (temp.attribute != 0xffffffff) if (temp.attribute != 0xffffffff)
return temp.attribute; return temp.attribute;
effect_set effects; effect_set effects;
int32 attribute = get_base_attribute(); effect_set effects2;
temp.attribute = attribute; int32 attribute = data.attribute;
temp.attribute = data.attribute;
filter_effect(EFFECT_ADD_ATTRIBUTE, &effects, FALSE); filter_effect(EFFECT_ADD_ATTRIBUTE, &effects, FALSE);
filter_effect(EFFECT_REMOVE_ATTRIBUTE, &effects, FALSE); filter_effect(EFFECT_REMOVE_ATTRIBUTE, &effects);
filter_effect(EFFECT_CHANGE_ATTRIBUTE, &effects); filter_effect(EFFECT_CHANGE_ATTRIBUTE, &effects2);
for (int32 i = 0; i < effects.size(); ++i) { for (int32 i = 0; i < effects.size(); ++i) {
if (effects[i]->code == EFFECT_ADD_ATTRIBUTE) if (effects[i]->code == EFFECT_ADD_ATTRIBUTE)
attribute |= effects[i]->get_value(this); attribute |= effects[i]->get_value(this);
else if (effects[i]->code == EFFECT_REMOVE_ATTRIBUTE)
attribute &= ~(effects[i]->get_value(this));
else else
attribute = effects[i]->get_value(this); attribute &= ~(effects[i]->get_value(this));
temp.attribute = attribute;
}
for (int32 i = 0; i < effects2.size(); ++i) {
attribute = effects2[i]->get_value(this);
temp.attribute = attribute; temp.attribute = attribute;
} }
temp.attribute = 0xffffffff; temp.attribute = 0xffffffff;
...@@ -653,25 +657,28 @@ uint32 card::get_base_race() { ...@@ -653,25 +657,28 @@ uint32 card::get_base_race() {
uint32 card::get_race() { uint32 card::get_race() {
if(assume_type == ASSUME_RACE) if(assume_type == ASSUME_RACE)
return assume_value; return assume_value;
if(!(current.location & LOCATION_ONFIELD) && !(data.type & TYPE_MONSTER)) if(current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER) && !(get_type() & TYPE_MONSTER))
return 0; return 0;
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE))) if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)))
return data.race; return data.race;
if (temp.race != 0xffffffff) if (temp.race != 0xffffffff)
return temp.race; return temp.race;
effect_set effects; effect_set effects;
int32 race = get_base_race(); effect_set effects2;
temp.race = race; int32 race = data.race;
temp.race = data.race;
filter_effect(EFFECT_ADD_RACE, &effects, FALSE); filter_effect(EFFECT_ADD_RACE, &effects, FALSE);
filter_effect(EFFECT_REMOVE_RACE, &effects, FALSE); filter_effect(EFFECT_REMOVE_RACE, &effects);
filter_effect(EFFECT_CHANGE_RACE, &effects); filter_effect(EFFECT_CHANGE_RACE, &effects2);
for (int32 i = 0; i < effects.size(); ++i) { for (int32 i = 0; i < effects.size(); ++i) {
if (effects[i]->code == EFFECT_ADD_RACE) if (effects[i]->code == EFFECT_ADD_RACE)
race |= effects[i]->get_value(this); race |= effects[i]->get_value(this);
else if (effects[i]->code == EFFECT_REMOVE_RACE)
race &= ~(effects[i]->get_value(this));
else else
race = effects[i]->get_value(this); race &= ~(effects[i]->get_value(this));
temp.race = race;
}
for (int32 i = 0; i < effects2.size(); ++i) {
race = effects2[i]->get_value(this);
temp.race = race; temp.race = race;
} }
temp.race = 0xffffffff; temp.race = 0xffffffff;
......
...@@ -1524,7 +1524,7 @@ int32 scriptlib::card_is_level_below(lua_State *L) { ...@@ -1524,7 +1524,7 @@ int32 scriptlib::card_is_level_below(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
uint32 lvl = lua_tointeger(L, 2); uint32 lvl = lua_tointeger(L, 2);
if((pcard->data.type & TYPE_XYZ) || (pcard->status & STATUS_NO_LEVEL) if((pcard->data.type & TYPE_XYZ) || (pcard->status & STATUS_NO_LEVEL)
|| (!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD))) || (!(pcard->data.type & TYPE_MONSTER) && !(pcard->get_type() & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE)))
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
else else
lua_pushboolean(L, pcard->get_level() <= lvl); lua_pushboolean(L, pcard->get_level() <= lvl);
...@@ -1536,7 +1536,7 @@ int32 scriptlib::card_is_level_above(lua_State *L) { ...@@ -1536,7 +1536,7 @@ int32 scriptlib::card_is_level_above(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
uint32 lvl = lua_tointeger(L, 2); uint32 lvl = lua_tointeger(L, 2);
if((pcard->data.type & TYPE_XYZ) || (pcard->status & STATUS_NO_LEVEL) if((pcard->data.type & TYPE_XYZ) || (pcard->status & STATUS_NO_LEVEL)
|| (!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD))) || (!(pcard->data.type & TYPE_MONSTER) && !(pcard->get_type() & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE)))
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
else else
lua_pushboolean(L, pcard->get_level() >= lvl); lua_pushboolean(L, pcard->get_level() >= lvl);
...@@ -1571,7 +1571,7 @@ int32 scriptlib::card_is_attack_below(lua_State *L) { ...@@ -1571,7 +1571,7 @@ int32 scriptlib::card_is_attack_below(lua_State *L) {
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);
int32 atk = lua_tointeger(L, 2); int32 atk = lua_tointeger(L, 2);
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD)) if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->get_type() & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE))
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
else { else {
int _atk = pcard->get_attack(); int _atk = pcard->get_attack();
...@@ -1584,7 +1584,7 @@ int32 scriptlib::card_is_attack_above(lua_State *L) { ...@@ -1584,7 +1584,7 @@ int32 scriptlib::card_is_attack_above(lua_State *L) {
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);
int32 atk = lua_tointeger(L, 2); int32 atk = lua_tointeger(L, 2);
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD)) if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->get_type() & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE))
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
else { else {
int _atk = pcard->get_attack(); int _atk = pcard->get_attack();
...@@ -1597,7 +1597,7 @@ int32 scriptlib::card_is_defence_below(lua_State *L) { ...@@ -1597,7 +1597,7 @@ int32 scriptlib::card_is_defence_below(lua_State *L) {
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);
int32 def = lua_tointeger(L, 2); int32 def = lua_tointeger(L, 2);
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD)) if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->get_type() & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE))
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
else { else {
int _def = pcard->get_defence(); int _def = pcard->get_defence();
...@@ -1610,7 +1610,7 @@ int32 scriptlib::card_is_defence_above(lua_State *L) { ...@@ -1610,7 +1610,7 @@ int32 scriptlib::card_is_defence_above(lua_State *L) {
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);
int32 def = lua_tointeger(L, 2); int32 def = lua_tointeger(L, 2);
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->current.location & LOCATION_ONFIELD)) if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->get_type() & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE))
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
else { else {
int _def = pcard->get_defence(); int _def = pcard->get_defence();
...@@ -1877,10 +1877,10 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) { ...@@ -1877,10 +1877,10 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) {
peffect->value = TYPE_MONSTER | TYPE_TRAPMONSTER | extra_type; peffect->value = TYPE_MONSTER | TYPE_TRAPMONSTER | extra_type;
pcard->add_effect(peffect); pcard->add_effect(peffect);
//attribute //attribute
/*peffect = pduel->new_effect(); peffect = pduel->new_effect();
peffect->owner = pcard; peffect->owner = pcard;
peffect->type = EFFECT_TYPE_SINGLE; peffect->type = EFFECT_TYPE_SINGLE;
peffect->code = EFFECT_CHANGE_ATTRIBUTE; peffect->code = EFFECT_ADD_ATTRIBUTE;
peffect->flag = EFFECT_FLAG_CANNOT_DISABLE; peffect->flag = EFFECT_FLAG_CANNOT_DISABLE;
peffect->reset_flag = RESET_EVENT + 0x47e0000; peffect->reset_flag = RESET_EVENT + 0x47e0000;
peffect->value = attribute; peffect->value = attribute;
...@@ -1889,11 +1889,11 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) { ...@@ -1889,11 +1889,11 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) {
peffect = pduel->new_effect(); peffect = pduel->new_effect();
peffect->owner = pcard; peffect->owner = pcard;
peffect->type = EFFECT_TYPE_SINGLE; peffect->type = EFFECT_TYPE_SINGLE;
peffect->code = EFFECT_CHANGE_RACE; peffect->code = EFFECT_ADD_RACE;
peffect->flag = EFFECT_FLAG_CANNOT_DISABLE; peffect->flag = EFFECT_FLAG_CANNOT_DISABLE;
peffect->reset_flag = RESET_EVENT + 0x47e0000; peffect->reset_flag = RESET_EVENT + 0x47e0000;
peffect->value = race; peffect->value = race;
pcard->add_effect(peffect);*/ pcard->add_effect(peffect);
//level //level
peffect = pduel->new_effect(); peffect = pduel->new_effect();
peffect->owner = pcard; peffect->owner = pcard;
......
...@@ -67,18 +67,6 @@ function c77462146.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -67,18 +67,6 @@ function c77462146.spop(e,tp,eg,ep,ev,re,r,rp)
e1:SetValue(TYPE_NORMAL+TYPE_MONSTER) e1:SetValue(TYPE_NORMAL+TYPE_MONSTER)
e1:SetReset(RESET_EVENT+0x47c0000) e1:SetReset(RESET_EVENT+0x47c0000)
c:RegisterEffect(e1,true) c:RegisterEffect(e1,true)
local e4=e1:Clone()
e4:SetCode(EFFECT_CHANGE_LEVEL)
e4:SetValue(4)
c:RegisterEffect(e4,true)
local e5=e1:Clone()
e5:SetCode(EFFECT_SET_BASE_ATTACK)
e5:SetValue(0)
c:RegisterEffect(e5,true)
local e6=e1:Clone()
e6:SetCode(EFFECT_SET_BASE_DEFENCE)
e6:SetValue(300)
c:RegisterEffect(e6,true)
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_DEFENCE) Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_DEFENCE)
local e7=Effect.CreateEffect(c) local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_SINGLE) e7:SetType(EFFECT_TYPE_SINGLE)
......
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