Commit 1a165388 authored by argon.sun's avatar argon.sun

fix

parent 79dc2d3b
......@@ -481,6 +481,8 @@ uint32 card::get_ritual_level(card* pcard) {
uint32 card::get_attribute() {
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)))
return data.attribute;
if((current.location == LOCATION_GRAVE) && (data.type & (TYPE_SPELL + TYPE_TRAP)))
return data.attribute;
if (temp.attribute != 0xffffffff)
return temp.attribute;
effect_set effects;
......@@ -504,6 +506,8 @@ uint32 card::get_attribute() {
uint32 card::get_race() {
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)))
return data.race;
if((current.location == LOCATION_GRAVE) && (data.type & (TYPE_SPELL + TYPE_TRAP)))
return data.race;
if (temp.race != 0xffffffff)
return temp.race;
effect_set effects;
......
......@@ -2588,7 +2588,7 @@ int32 field::process_battle_command(uint16 step) {
}
for(uint32 i = 0; i < 5; ++i) {
if(player[1 - infos.turn_player].list_mzone[i])
core.pre_field[i] = player[1 - infos.turn_player].list_mzone[i]->fieldid;
core.pre_field[i] = player[1 - infos.turn_player].list_mzone[i]->fieldid_r;
else
core.pre_field[i] = 0;
}
......@@ -2597,7 +2597,7 @@ int32 field::process_battle_command(uint16 step) {
raise_single_event(core.attacker, 0, EVENT_ATTACK_ANNOUNCE, 0, 0, 0, infos.turn_player, 0);
raise_event(core.attacker, EVENT_ATTACK_ANNOUNCE, 0, 0, 0, infos.turn_player, 0);
}
core.units.begin()->arg2 = (core.attacker->current.controler << 16) + core.attacker->fieldid;
core.units.begin()->arg2 = (core.attacker->current.controler << 16) + core.attacker->fieldid_r;
process_single_event();
process_instant_event();
core.hint_timing[infos.turn_player] = TIMING_ATTACK;
......@@ -2637,10 +2637,10 @@ int32 field::process_battle_command(uint16 step) {
effect* peffect;
if(peffect = is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_BP)) {
reset_phase(PHASE_DAMAGE);
if(core.attacker->fieldid == afid) {
if(core.attacker->fieldid_r == afid) {
if(!atk_disabled) {
if(core.attack_target)
core.attacker->attacked_cards[core.attack_target->fieldid] = core.attack_target;
core.attacker->attacked_cards[core.attack_target->fieldid_r] = core.attack_target;
else
core.attacker->attacked_cards[0] = 0;
}
......@@ -2659,16 +2659,16 @@ int32 field::process_battle_command(uint16 step) {
return FALSE;
}
if(atk_disabled || !core.attacker->is_capable_attack() || core.attacker->is_status(STATUS_ATTACK_CANCELED)
|| core.attacker->current.controler != acon || core.attacker->fieldid != afid) {
if(core.attacker->fieldid == afid) {
|| core.attacker->current.controler != acon || core.attacker->fieldid_r != afid) {
if(core.attacker->fieldid_r == afid) {
if(core.attack_target)
core.attacker->announced_cards[core.attack_target->fieldid] = core.attack_target;
core.attacker->announced_cards[core.attack_target->fieldid_r] = core.attack_target;
else
core.attacker->announced_cards[0] = 0;
core.attacker->announce_count++;
if(!atk_disabled) {
if(core.attack_target)
core.attacker->attacked_cards[core.attack_target->fieldid] = core.attack_target;
core.attacker->attacked_cards[core.attack_target->fieldid_r] = core.attack_target;
else
core.attacker->attacked_cards[0] = 0;
core.attacker->attacked_count++;
......@@ -2684,8 +2684,8 @@ int32 field::process_battle_command(uint16 step) {
pduel->write_buffer8(MSG_ATTACK);
pduel->write_buffer32(core.attacker->get_info_location());
if(core.sub_attack_target) {
core.attacker->announced_cards[core.sub_attack_target->fieldid] = core.sub_attack_target;
core.attacker->attacked_cards[core.sub_attack_target->fieldid] = core.sub_attack_target;
core.attacker->announced_cards[core.sub_attack_target->fieldid_r] = core.sub_attack_target;
core.attacker->attacked_cards[core.sub_attack_target->fieldid_r] = core.sub_attack_target;
pduel->write_buffer32(core.sub_attack_target->get_info_location());
} else {
core.attacker->announced_cards[0] = 0;
......@@ -2703,7 +2703,7 @@ int32 field::process_battle_command(uint16 step) {
return FALSE;
}
uint8 seq = core.chain_attack_target->current.sequence;
if(core.pre_field[seq] != core.chain_attack_target->fieldid) {
if(core.pre_field[seq] != core.chain_attack_target->fieldid_r) {
core.units.begin()->step = -1;
reset_phase(PHASE_DAMAGE);
return FALSE;
......@@ -2715,7 +2715,7 @@ int32 field::process_battle_command(uint16 step) {
core.units.begin()->arg2 = get_attack_target(core.attacker, &core.select_cards, core.chain_attack);
for(uint32 i = 0; i < 5; ++i) {
if(player[1 - infos.turn_player].list_mzone[i]) {
if(!core.pre_field[i] || core.pre_field[i] != player[1 - infos.turn_player].list_mzone[i]->fieldid) {
if(!core.pre_field[i] || core.pre_field[i] != player[1 - infos.turn_player].list_mzone[i]->fieldid_r) {
rollback = true;
break;
}
......@@ -2732,8 +2732,8 @@ int32 field::process_battle_command(uint16 step) {
core.attacker->announce_count++;
core.attacker->attacked_count++;
if(core.attack_target) {
core.attacker->announced_cards[core.attack_target->fieldid] = core.attack_target;
core.attacker->attacked_cards[core.attack_target->fieldid] = core.attack_target;
core.attacker->announced_cards[core.attack_target->fieldid_r] = core.attack_target;
core.attacker->attacked_cards[core.attack_target->fieldid_r] = core.attack_target;
} else {
core.attacker->announced_cards[0] = 0;
core.attacker->attacked_cards[0] = 0;
......@@ -2761,13 +2761,14 @@ int32 field::process_battle_command(uint16 step) {
}
case 11: {
if(returns.ivalue[0]) {
core.attack_cancelable = FALSE;
core.units.begin()->arg1 = TRUE;
core.units.begin()->step = 3;
return FALSE;
}
core.attacker->announce_count++;
if(core.attack_target)
core.attacker->announced_cards[core.attack_target->fieldid] = core.attack_target;
core.attacker->announced_cards[core.attack_target->fieldid_r] = core.attack_target;
else
core.attacker->announced_cards[0] = 0;
core.units.begin()->step = -1;
......@@ -2788,9 +2789,9 @@ int32 field::process_battle_command(uint16 step) {
core.attacker = core.sub_attacker;
if(core.sub_attack_target != (card*)0xffffffff)
core.attack_target = core.sub_attack_target;
core.pre_field[0] = core.attacker->fieldid;
core.pre_field[0] = core.attacker->fieldid_r;
if(core.attack_target)
core.pre_field[1] = core.attack_target->fieldid;
core.pre_field[1] = core.attack_target->fieldid_r;
else
core.pre_field[1] = 0;
raise_single_event(core.attacker, 0, EVENT_BATTLE_START, 0, 0, 0, 0, 0);
......@@ -2807,8 +2808,8 @@ int32 field::process_battle_command(uint16 step) {
return FALSE;
}
case 21: {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid != core.pre_field[0]
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE || core.attack_target->fieldid != core.pre_field[1]))) {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid_r != core.pre_field[0]
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE || core.attack_target->fieldid_r != core.pre_field[1]))) {
core.units.begin()->arg1 = 0;
core.damage_calculated = TRUE;
core.units.begin()->step = 30;
......@@ -2844,7 +2845,7 @@ int32 field::process_battle_command(uint16 step) {
raise_single_event(core.attacker, 0, EVENT_BATTLE_CONFIRM, 0, 0, 0, 0, 0);
if(core.attack_target) {
if(core.attack_target->temp.position & POS_FACEDOWN)
core.pre_field[1] = core.attack_target->fieldid;
core.pre_field[1] = core.attack_target->fieldid_r;
raise_single_event(core.attack_target, 0, EVENT_BATTLE_CONFIRM, 0, 0, 0, 0, 1);
}
raise_event((card*)0, EVENT_BATTLE_CONFIRM, 0, 0, 0, 0, 0);
......@@ -2874,15 +2875,15 @@ int32 field::process_battle_command(uint16 step) {
core.attacker = core.sub_attacker;
core.attack_target = core.sub_attack_target;
core.units.begin()->step = 20;
core.pre_field[0] = core.attacker->fieldid;
core.pre_field[0] = core.attacker->fieldid_r;
if(core.attack_target)
core.pre_field[1] = core.attack_target->fieldid;
core.pre_field[1] = core.attack_target->fieldid_r;
else
core.pre_field[1] = 0;
return FALSE;
}
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid != core.pre_field[0]
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE || core.attack_target->fieldid != core.pre_field[1]))) {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid_r != core.pre_field[0]
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE || core.attack_target->fieldid_r != core.pre_field[1]))) {
core.units.begin()->arg1 = 0;
core.damage_calculated = TRUE;
core.units.begin()->step = 30;
......@@ -2911,8 +2912,8 @@ int32 field::process_battle_command(uint16 step) {
return FALSE;
}
case 25: {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid != core.pre_field[0]
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE || core.attack_target->fieldid != core.pre_field[1]))) {
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid_r != core.pre_field[0]
|| (core.attack_target && (core.attack_target->current.location != LOCATION_MZONE || core.attack_target->fieldid_r != core.pre_field[1]))) {
core.units.begin()->arg1 = 0;
core.damage_calculated = TRUE;
core.units.begin()->step = 30;
......@@ -3105,8 +3106,8 @@ int32 field::process_battle_command(uint16 step) {
core.hint_timing[infos.turn_player] = 0;
core.chain_attack = FALSE;
if(core.attack_target) {
core.attacker->battled_cards[core.attack_target->fieldid] = core.attack_target;
core.attack_target->battled_cards[core.attacker->fieldid] = core.attacker;
core.attacker->battled_cards[core.attack_target->fieldid_r] = core.attack_target;
core.attack_target->battled_cards[core.attacker->fieldid_r] = core.attacker;
} else
core.attacker->battled_cards[0] = 0;
uint8 reason_player = core.temp_var[0];
......@@ -3142,7 +3143,7 @@ int32 field::process_battle_command(uint16 step) {
effect* peffect;
uint32 dest, seq;
if(core.attacker->is_status(STATUS_BATTLE_DESTROYED)
&& core.attacker->current.location == LOCATION_MZONE && core.attacker->fieldid == core.pre_field[0]) {
&& core.attacker->current.location == LOCATION_MZONE && core.attacker->fieldid_r == core.pre_field[0]) {
des.insert(core.attacker);
core.attacker->temp.reason = core.attacker->current.reason;
core.attacker->temp.reason_card = core.attacker->current.reason_card;
......@@ -3162,7 +3163,7 @@ int32 field::process_battle_command(uint16 step) {
core.attacker->operation_param = (POS_FACEUP << 24) + (((uint32)core.attacker->owner) << 16) + (dest << 8) + seq;
}
if(core.attack_target && core.attack_target->is_status(STATUS_BATTLE_DESTROYED)
&& core.attack_target->current.location == LOCATION_MZONE && core.attack_target->fieldid == core.pre_field[1]) {
&& core.attack_target->current.location == LOCATION_MZONE && core.attack_target->fieldid_r == core.pre_field[1]) {
des.insert(core.attack_target);
core.attack_target->temp.reason = core.attack_target->current.reason;
core.attack_target->temp.reason_card = core.attack_target->current.reason_card;
......@@ -3247,7 +3248,7 @@ int32 field::process_battle_command(uint16 step) {
card_set::iterator cit, rm;
for(cit = des->container.begin(); cit != des->container.end();) {
rm = cit++;
if((*rm)->current.location != LOCATION_MZONE || ((*rm)->fieldid != core.pre_field[0] && (*rm)->fieldid != core.pre_field[1]))
if((*rm)->current.location != LOCATION_MZONE || ((*rm)->fieldid_r != core.pre_field[0] && (*rm)->fieldid_r != core.pre_field[1]))
des->container.erase(rm);
}
add_process(PROCESSOR_DESTROY, 2, 0, des, REASON_BATTLE, PLAYER_NONE);
......@@ -3294,7 +3295,7 @@ int32 field::process_battle_command(uint16 step) {
reset_phase(PHASE_DAMAGE);
adjust_all();
if(core.chain_attack) {
if(core.attacker->is_status(STATUS_BATTLE_DESTROYED) || core.attacker->fieldid != core.pre_field[0]
if(core.attacker->is_status(STATUS_BATTLE_DESTROYED) || core.attacker->fieldid_r != core.pre_field[0]
|| !core.attacker->is_capable_attack_announce(infos.turn_player))
return FALSE;
if(core.chain_attack_target) {
......
......@@ -21,7 +21,7 @@ function c11596936.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.ShuffleHand(tp)
end
function c11596936.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
return c:IsFacedown() and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
end
function c11596936.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c11596936.filter,tp,0,LOCATION_ONFIELD,1,nil) end
......
......@@ -17,14 +17,26 @@ function c14785765.costfilter(c)
return c:IsFaceup() and c:IsAbleToHandAsCost()
end
function c14785765.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return c14785765[tp] and Duel.IsExistingMatchingCard(c14785765.costfilter,tp,LOCATION_ONFIELD,0,1,nil) end
if chk==0 then
if not c14785765[tp] then return false end
if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then
return Duel.IsExistingMatchingCard(c14785765.costfilter,tp,LOCATION_MZONE,0,1,nil)
else
return Duel.IsExistingMatchingCard(c14785765.costfilter,tp,LOCATION_ONFIELD,0,1,nil)
end
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then
local g=Duel.SelectMatchingCard(tp,c14785765.costfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SendtoHand(g,nil,REASON_COST)
else
local g=Duel.SelectMatchingCard(tp,c14785765.costfilter,tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.SendtoHand(g,nil,REASON_COST)
end
c14785765[tp]=false
end
function c14785765.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,400)
end
......
......@@ -3,7 +3,7 @@ function c41639001.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(41639001,0))
e1:SetType(EFFECT_TYPE_QUICK_F)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_BECOME_TARGET)
e1:SetRange(LOCATION_MZONE)
......
--`ɡ֥쥤`
function c51047350.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_SPSUM_PARAM)
e1:SetTargetRange(POS_FACEUP_ATTACK,0)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c51047350.spcon)
e1:SetOperation(c51047350.spop)
c:RegisterEffect(e1)
end
function c51047350.filter(c)
return c:GetSequence()~=5 and c:IsAbleToGraveAsCost()
end
function c51047350.spcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and
Duel.IsExistingMatchingCard(c51047350.filter,c:GetControler(),LOCATION_SZONE,0,1,nil)
end
function c51047350.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c51047350.filter,tp,LOCATION_SZONE,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
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