Commit 3b606497 authored by Fluorohydride's avatar Fluorohydride

Merge pull request #424 from VanillaSalt/patch57

fix
parents 4c56d879 5abb10ca
......@@ -682,7 +682,8 @@ void card::apply_field_effect() {
if (current.controler == PLAYER_NONE)
return;
for (auto it = field_effect.begin(); it != field_effect.end(); ++it) {
if ((current.location & it->second->range) || ((it->second->range & LOCATION_HAND) && (it->second->type & EFFECT_TYPE_TRIGGER_O)))
if ((current.location & it->second->range) || ((it->second->range & LOCATION_HAND)
&& (it->second->type & EFFECT_TYPE_TRIGGER_O) && !(it->second->code & EVENT_PHASE)))
pduel->game_field->add_effect(it->second);
}
if(unique_code && (current.location & LOCATION_ONFIELD))
......@@ -692,7 +693,8 @@ void card::cancel_field_effect() {
if (current.controler == PLAYER_NONE)
return;
for (auto it = field_effect.begin(); it != field_effect.end(); ++it) {
if ((current.location & it->second->range) || ((it->second->range & LOCATION_HAND) && (it->second->type & EFFECT_TYPE_TRIGGER_O)))
if ((current.location & it->second->range) || ((it->second->range & LOCATION_HAND)
&& (it->second->type & EFFECT_TYPE_TRIGGER_O) && !(it->second->code & EVENT_PHASE)))
pduel->game_field->remove_effect(it->second);
}
if(unique_code && current.location & LOCATION_ONFIELD)
......
......@@ -397,7 +397,7 @@ int32 effect::is_chainable(uint8 tp) {
if((type & EFFECT_TYPE_ACTIVATE) && (sp <= 1) && !(flag & EFFECT_FLAG_COF))
return FALSE;
if(pduel->game_field->core.current_chain.size()) {
if((type & EFFECT_TYPE_TRIGGER_O) && (handler->current.location == LOCATION_HAND)) {
if(!(flag & EFFECT_FLAG_FIELD_ONLY) && (type & EFFECT_TYPE_TRIGGER_O) && (handler->current.location == LOCATION_HAND)) {
if(pduel->game_field->core.current_chain.rbegin()->triggering_effect->get_speed() > 2)
return FALSE;
} else if(sp < pduel->game_field->core.current_chain.rbegin()->triggering_effect->get_speed())
......
......@@ -1734,7 +1734,8 @@ int32 field::process_point_event(int16 step, int32 special, int32 skip_new) {
for (auto clit = core.new_ochain_s.begin(); clit != core.new_ochain_s.end(); ++clit) {
effect* peffect = clit->triggering_effect;
if((!(peffect->flag & (EFFECT_FLAG_EVENT_PLAYER | EFFECT_FLAG_BOTH_SIDE)) && peffect->handler->is_has_relation(peffect))
|| ((peffect->range & LOCATION_HAND) && peffect->handler->current.location == LOCATION_HAND)) {
|| (!(peffect->flag & EFFECT_FLAG_FIELD_ONLY) && (peffect->type & EFFECT_TYPE_FIELD)
&& (peffect->range & LOCATION_HAND) && peffect->handler->current.location == LOCATION_HAND)) {
if(!peffect->handler->is_has_relation(peffect))
peffect->handler->create_relation(peffect);
clit->triggering_player = peffect->handler->current.controler;
......@@ -1769,10 +1770,11 @@ int32 field::process_point_event(int16 step, int32 special, int32 skip_new) {
if(peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE)
&& ((peffect->code == EVENT_FLIP) || (clit->triggering_location & 0x3)
|| !(peffect->handler->current.location & 0x3) || peffect->handler->is_status(STATUS_IS_PUBLIC))) {
if((peffect->range & LOCATION_HAND) && clit->triggering_location == LOCATION_HAND) {
if(!(peffect->flag & EFFECT_FLAG_FIELD_ONLY) && clit->triggering_location == LOCATION_HAND
&& (((peffect->type & EFFECT_TYPE_SINGLE) && !(peffect->flag & EFFECT_FLAG_SINGLE_RANGE)) || (peffect->range & LOCATION_HAND))) {
core.new_ochain_h.push_back(*clit);
act = false;
} else if(!(peffect->type & EFFECT_TYPE_FIELD) || (clit->triggering_location & peffect->range)) {
} else if((peffect->flag & EFFECT_FLAG_FIELD_ONLY) || !(peffect->type & EFFECT_TYPE_FIELD) || (clit->triggering_location & peffect->range)) {
if(peffect->flag & EFFECT_FLAG_CHAIN_UNIQUE) {
if(tp == infos.turn_player) {
for(auto tpit = core.tpchain.begin(); tpit != core.tpchain.end(); ++tpit) {
......
......@@ -18,7 +18,6 @@ function c1412158.initial_effect(c)
e2:SetDescription(aux.Stringid(1412158,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c1412158.spcon)
e2:SetTarget(c1412158.sptg)
......
......@@ -35,11 +35,28 @@ function c16886617.rfilter(c)
end
function c16886617.spcon(e,c)
if c==nil then return true end
return Duel.IsExistingMatchingCard(c16886617.rfilter,0,LOCATION_MZONE,LOCATION_MZONE,2,nil)
local tp=c:GetControler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft+1
if ct>2 then return false end
if ct>0 and not Duel.IsExistingMatchingCard(c16886617.rfilter,tp,LOCATION_MZONE,0,ct,nil) then return false end
return Duel.IsExistingMatchingCard(c16886617.rfilter,tp,LOCATION_MZONE,LOCATION_MZONE,2,nil)
end
function c16886617.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,c16886617.rfilter,0,LOCATION_MZONE,LOCATION_MZONE,2,2,nil)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ct=-ft+1
if ct<0 then ct=0 end
local g=Group.CreateGroup()
if ct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=Duel.SelectMatchingCard(tp,c16886617.rfilter,tp,LOCATION_MZONE,0,ct,ct,nil)
g:Merge(sg)
end
if ct<2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local sg=Duel.SelectMatchingCard(tp,c16886617.rfilter,tp,LOCATION_MZONE,LOCATION_MZONE,2-ct,2-ct,g:GetFirst())
g:Merge(sg)
end
Duel.Release(g,REASON_COST)
end
function c16886617.desfilter(c)
......
......@@ -4,7 +4,6 @@ function c23168060.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(23168060,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c23168060.condition)
......
......@@ -3,9 +3,8 @@ function c25788011.initial_effect(c)
--lv up
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(25788011,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetTarget(c25788011.target)
e1:SetOperation(c25788011.operation)
......
......@@ -5,7 +5,6 @@ function c4904812.initial_effect(c)
e1:SetDescription(aux.Stringid(4904812,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCost(c4904812.cost)
e1:SetTarget(c4904812.target)
......
......@@ -52,7 +52,11 @@ function c49221191.operation(e,tp,eg,ep,ev,re,r,rp)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END+RESET_SELF_TURN)
if Duel.GetTurnPlayer()~=tp then
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,2)
else
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,1)
end
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENCE_FINAL)
......
......@@ -17,6 +17,7 @@ function c50433147.initial_effect(c)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(50433147,0))
e3:SetCategory(CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(c50433147.descon)
......
......@@ -18,7 +18,6 @@ function c75923050.initial_effect(c)
e2:SetDescription(aux.Stringid(75923050,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c75923050.spcon)
e2:SetTarget(c75923050.sptg)
......
......@@ -8,7 +8,6 @@ function c84747429.initial_effect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCost(c84747429.descost)
e1:SetTarget(c84747429.destg)
e1:SetOperation(c84747429.desop)
......
......@@ -17,7 +17,6 @@ function c91350799.initial_effect(c)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetCost(c91350799.spcost)
e2:SetTarget(c91350799.sptg)
e2:SetOperation(c91350799.spop)
......
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