Commit c87b477b authored by Fluorohydride's avatar Fluorohydride

Merge pull request #581 from VanillaSalt/patch72

fix
parents bde95ef4 e86e6b5d
......@@ -490,7 +490,7 @@ uint32 card::get_rank() {
filter_effect(EFFECT_UPDATE_RANK, &effects, FALSE);
filter_effect(EFFECT_CHANGE_RANK, &effects);
for (int32 i = 0; i < effects.count; ++i) {
if (effects[i]->code == EFFECT_UPDATE_LEVEL) {
if (effects[i]->code == EFFECT_UPDATE_RANK) {
if ((effects[i]->type & EFFECT_TYPE_SINGLE) && !(effects[i]->flag & EFFECT_FLAG_SINGLE_RANGE))
up += effects[i]->get_value(this);
else
......@@ -958,7 +958,6 @@ void card::reset(uint32 id, uint32 reset_type) {
attacked_cards.clear();
announce_count = 0;
attacked_count = 0;
attack_negated_count = 0;
attack_all_target = TRUE;
}
if(id & 0x5fe0000) {
......
......@@ -93,7 +93,6 @@ public:
uint32 operation_param;
uint8 announce_count;
uint8 attacked_count;
uint8 attack_negated_count;
uint8 attack_all_target;
uint16 cardid;
uint32 fieldid;
......
......@@ -681,7 +681,7 @@ int32 scriptlib::card_get_attack_announced_count(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->announce_count - pcard->attack_negated_count);
lua_pushinteger(L, pcard->announce_count);
return 1;
}
int32 scriptlib::card_is_direct_attacked(lua_State *L) {
......
......@@ -2870,7 +2870,6 @@ int32 field::process_battle_command(uint16 step) {
atk_disabled = true;
pduel->write_buffer8(MSG_ATTACK_DISABLED);
core.attacker->set_status(STATUS_ATTACK_CANCELED, TRUE);
core.attacker->attack_negated_count++;
}
effect* peffect;
if((peffect = is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_BP))) {
......
......@@ -10,9 +10,20 @@ function c10118318.initial_effect(c)
e1:SetTarget(c10118318.target)
e1:SetOperation(c10118318.activate)
c:RegisterEffect(e1)
if not c10118318.global_check then
c10118318.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PHASE_START+PHASE_BATTLE)
ge1:SetOperation(c10118318.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c10118318.checkop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(Duel.GetTurnPlayer(),10118318,RESET_PHASE+PHASE_END,0,1)
end
function c10118318.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetTurnPlayer()~=tp or Duel.GetCurrentPhase()<=PHASE_MAIN1 end
if chk==0 then return Duel.GetTurnPlayer()~=tp or Duel.GetFlagEffect(tp,10118318)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BP)
......
......@@ -11,7 +11,7 @@ function c13629812.initial_effect(c)
e1:SetTarget(c13629812.target)
e1:SetOperation(c13629812.operation)
c:RegisterEffect(e1)
--Destroy
--return
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(13629812,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
......@@ -63,7 +63,7 @@ end
function c13629812.retcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=c:GetFirstCardTarget()
if tc and tc:IsLocation(LOCATION_REMOVED) and tc:IsFaceup() and c:IsLocation(LOCATION_GRAVE) then
if tc and tc:IsLocation(LOCATION_REMOVED) and tc:IsFaceup() and not c:IsLocation(LOCATION_DECK) then
e:SetLabelObject(tc)
tc:CreateEffectRelation(e)
return true
......
......@@ -23,7 +23,7 @@ function c15335853.initial_effect(c)
--banish
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(15335853,0))
e4:SetCategory(CATEGORY_DESTROY)
e4:SetCategory(CATEGORY_REMOVE)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
......
......@@ -16,7 +16,7 @@ function c18511599.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(18511599,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_QUICK_O)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c18511599.cost)
......@@ -28,7 +28,7 @@ function c18511599.indcon(e)
return e:GetHandler():GetOverlayCount()~=0
end
function c18511599.filter(c,e,tp)
return c:IsControler(1-tp) and (not e or c:IsRelateToEffect(e))
return c:IsControler(1-tp) and c:IsDestructable() and (not e or c:IsRelateToEffect(e))
end
function c18511599.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
......@@ -36,8 +36,9 @@ function c18511599.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c18511599.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(c18511599.filter,1,nil,nil,tp) end
local g=eg:Filter(c18511599.filter,nil,nil,tp)
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,eg:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c18511599.operation(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(c18511599.filter,nil,e,tp)
......
......@@ -50,6 +50,7 @@ function c23232295.atkop(e,tp,eg,ep,ev,re,r,rp)
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1ff0000)
e1:SetValue(800)
......
......@@ -14,7 +14,7 @@ end
function c30585393.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tc=eg:GetFirst()
if chkc then return chkc==tc end
if chk==0 then return eg:GetCount()==1 and tc:GetPreviousControler()==tp
if chk==0 then return eg:GetCount()==1 and tc:GetPreviousControler()==tp and tc:IsPreviousLocation(LOCATION_MZONE)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and tc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and tc:IsReason(REASON_EFFECT)
and tc:IsCanBeEffectTarget(e) and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) end
......
......@@ -26,9 +26,10 @@ function c30646525.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c30646525.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFacedown() or not c:IsRelateToEffect(e) then return end
local g=Duel.GetMatchingGroup(c30646525.filter,tp,LOCATION_MZONE,LOCATION_MZONE,c,c:GetAttack())
local ct=Duel.Destroy(g,REASON_EFFECT)
if ct>0 and c:IsFaceup() and c:IsRelateToEffect(e) then
if ct>0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
......
......@@ -6,13 +6,6 @@ function c31828916.initial_effect(c)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_DESTROY)
e2:SetRange(LOCATION_SZONE)
e2:SetOperation(c31828916.check)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetDescription(aux.Stringid(31828916,0))
......@@ -22,19 +15,11 @@ function c31828916.initial_effect(c)
e3:SetCountLimit(1)
e3:SetTarget(c31828916.target)
e3:SetOperation(c31828916.operation)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
end
function c31828916.check(e,tp,eg,ep,ev,re,r,rp)
if bit.band(r,REASON_BATTLE)==0 then return end
local pg=e:GetLabelObject()
if pg then pg:DeleteGroup() end
local dg=eg:Filter(Card.IsRace,nil,RACE_MACHINE)
e:SetLabelObject(dg)
dg:KeepAlive()
end
function c31828916.cfilter(c,cg,e,tp)
return c:IsRace(RACE_MACHINE) and c:IsControler(tp) and c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE) and cg:IsContains(c)
function c31828916.cfilter(c,e,tp)
return c:IsRace(RACE_MACHINE) and c:IsControler(tp) and c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE)
and bit.band(c:GetPreviousRaceOnField(),RACE_MACHINE)~=0
and Duel.IsExistingMatchingCard(c31828916.filter,tp,LOCATION_DECK,0,1,nil,c:GetAttack(),c:GetAttribute(),e,tp)
end
function c31828916.filter(c,atk,att,e,tp)
......@@ -44,7 +29,7 @@ function c31828916.filter(c,atk,att,e,tp)
end
function c31828916.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and eg:IsExists(c31828916.cfilter,1,nil,e:GetLabelObject():GetLabelObject(),e,tp) end
and eg:IsExists(c31828916.cfilter,1,nil,e,tp) end
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
......
......@@ -42,6 +42,35 @@ function c32391631.initial_effect(c)
e5:SetTarget(c32391631.destg)
e5:SetOperation(c32391631.desop)
c:RegisterEffect(e5)
if not c32391631.global_check then
c32391631.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_ATTACK_ANNOUNCE)
ge1:SetOperation(c32391631.check)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_ATTACK_DISABLED)
ge2:SetOperation(c32391631.check2)
Duel.RegisterEffect(ge2,0)
end
end
function c32391631.check(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local ct=tc:GetFlagEffectLabel(32391631)
if ct then
tc:SetFlagEffectLabel(32391631,ct+1)
else
tc:RegisterFlagEffect(32391631,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1,1)
end
end
function c32391631.check2(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local ct=tc:GetFlagEffectLabel(32391631)
if ct then
tc:SetFlagEffectLabel(32391631,ct-1)
end
end
function c32391631.rectg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......@@ -58,7 +87,8 @@ function c32391631.becon(e)
return Duel.IsExistingMatchingCard(Card.IsAttackable,Duel.GetTurnPlayer(),LOCATION_MZONE,0,1,nil)
end
function c32391631.desfilter(c)
return c:IsPosition(POS_FACEUP_ATTACK) and c:GetAttackAnnouncedCount()==0 and c:IsDestructable()
local ct=c:GetFlagEffectLabel(32391631)
return c:IsPosition(POS_FACEUP_ATTACK) and (not ct or ct==0) and c:IsDestructable()
end
function c32391631.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -74,7 +74,6 @@ function c33981008.spop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetMatchingGroupCount(c33981008.ctfilter,tp,LOCATION_GRAVE,0,nil)
local g=Duel.SelectMatchingCard(tp,c33981008.spfilter,tp,LOCATION_DECK+LOCATION_HAND,0,1,1,nil,e,tp,ct)
if g:GetCount()>0 then
Duel.HintSelection(g)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -44,7 +44,7 @@ function c41329458.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.RegisterFlagEffect(tp,41329458,RESET_PHASE+PHASE_END,0,1)
end
function c41329458.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
......@@ -59,7 +59,7 @@ function c41329458.cfilter(c)
end
function c41329458.spcost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c41329458.cfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,c41329458.cfilter,1,1,nil)
Duel.DiscardHand(tp,c41329458.cfilter,1,1,REASON_COST+REASON_DISCARD)
end
function c41329458.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -22,7 +22,7 @@ function c43543777.initial_effect(c)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(43543777,1))
e4:SetCategory(CATEGORY_TOHAND)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_SUMMON_SUCCESS)
e4:SetCost(c43543777.thcost)
......
......@@ -16,10 +16,10 @@ end
function c44424095.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsDestructable() end
if chk==0 then return Duel.IsExistingMatchingCard(c44424095.filter,tp,LOCATION_HAND,0,1,nil)
and Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
and Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler())
and Duel.IsPlayerCanDraw(tp,1) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
local dg=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
......
......@@ -21,7 +21,7 @@ function c45452224.initial_effect(c)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(45452224,1))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_SUMMON_SUCCESS)
e4:SetTarget(c45452224.sptg)
......
......@@ -21,6 +21,7 @@ function c47942531.valcheck(e,c)
if atk<0 then atk=0 end
--atk continuous effect
if e:GetLabel()==1 then
e:SetLabel(0)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
......@@ -28,7 +29,7 @@ function c47942531.valcheck(e,c)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(atk)
e1:SetReset(RESET_EVENT+0xff0000)
c:RegisterEffect(e1)
c:RegisterEffect(e1)
end
end
function c47942531.facechk(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -37,6 +37,7 @@ function c48934760.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end
local te=tc:GetActivateEffect()
local tep=tc:GetControler()
local cost=te:GetCost()
if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end
Duel.RaiseEvent(tc,EVENT_CHAIN_SOLVED,tc:GetActivateEffect(),0,tp,tp,Duel.GetCurrentChain())
......
......@@ -37,7 +37,7 @@ function c62953041.hspcon(e,c)
end
function c62953041.spreg(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if bit.band(r,0x41)~=0x41 or not c:IsPreviousPosition(POS_FACEUP) then return end
if bit.band(r,0x41)~=0x41 or not c:IsPreviousPosition(POS_FACEUP) or not c:IsPreviousLocation(LOCATION_ONFIELD) then return end
if Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_STANDBY then
e:SetLabel(Duel.GetTurnCount())
c:RegisterFlagEffect(62953041,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,0,2)
......
......@@ -13,13 +13,13 @@ function c65303664.initial_effect(c)
e1:SetOperation(c65303664.operation)
c:RegisterEffect(e1)
end
function c65303664.cfilter(c)
function c65303664.cfilter(c,tp)
return c:IsLocation(LOCATION_GRAVE) and c:IsType(TYPE_MONSTER) and c:IsRace(RACE_BEAST) and c:IsReason(REASON_BATTLE)
and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousControler()==tp
and bit.band(c:GetPreviousRaceOnField(),RACE_BEAST)~=0
end
function c65303664.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c65303664.cfilter,1,nil)
return eg:IsExists(c65303664.cfilter,1,nil,tp)
end
function c65303664.rfiletr(c)
return c:IsRace(RACE_BEAST) and c:IsAbleToRemoveAsCost()
......
......@@ -38,6 +38,7 @@ function c6614221.valcheck(e,c)
tc=g:GetNext()
end
if e:GetLabel()==1 then
e:SetLabel(0)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
......
......@@ -26,6 +26,35 @@ function c70902743.initial_effect(c)
e2:SetTarget(c70902743.target2)
e2:SetOperation(c70902743.operation2)
c:RegisterEffect(e2)
if not c70902743.global_check then
c70902743.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_ATTACK_ANNOUNCE)
ge1:SetOperation(c70902743.check)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_ATTACK_DISABLED)
ge2:SetOperation(c70902743.check2)
Duel.RegisterEffect(ge2,0)
end
end
function c70902743.check(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local ct=tc:GetFlagEffectLabel(70902743)
if ct then
tc:SetFlagEffectLabel(70902743,ct+1)
else
tc:RegisterFlagEffect(70902743,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1,1)
end
end
function c70902743.check2(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local ct=tc:GetFlagEffectLabel(70902743)
if ct then
tc:SetFlagEffectLabel(70902743,ct-1)
end
end
function c70902743.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker()==e:GetHandler() and Duel.GetAttackTarget() and not Duel.GetAttackTarget():IsAttackPos()
......@@ -43,7 +72,8 @@ function c70902743.operation1(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(g,REASON_EFFECT)
end
function c70902743.filter2(c)
return c:GetAttackAnnouncedCount()==0 and c:IsDestructable()
local ct=c:GetFlagEffectLabel(70902743)
return (not ct or ct==0) and c:IsDestructable()
end
function c70902743.condition2(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer()
......
......@@ -13,7 +13,8 @@ function c7092142.initial_effect(c)
c:RegisterEffect(e1)
end
function c7092142.cfilter(c,tp)
return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp and c:IsAttribute(ATTRIBUTE_WATER)
return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp and c:IsPreviousPosition(POS_FACEUP)
and c:IsAttribute(ATTRIBUTE_WATER) and bit.band(c:GetPreviousAttributeOnField(),ATTRIBUTE_WATER)~=0
end
function c7092142.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c7092142.cfilter,1,nil,tp)
......
......@@ -6,57 +6,63 @@ function c71645242.initial_effect(c)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--token
local g=Group.CreateGroup()
g:KeepAlive()
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71645242,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetCondition(c71645242.spcon)
e2:SetTarget(c71645242.sptg)
e2:SetOperation(c71645242.spop)
e2:SetLabelObject(g)
e2:SetCondition(c71645242.regcon)
e2:SetOperation(c71645242.regop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetLabelObject(g)
c:RegisterEffect(e3)
--special summon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(71645242,1))
e4:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetDescription(aux.Stringid(71645242,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetRange(LOCATION_SZONE)
e4:SetTarget(c71645242.sptg2)
e4:SetOperation(c71645242.spop2)
e4:SetCode(71645242)
e4:SetTarget(c71645242.sptg)
e4:SetOperation(c71645242.spop)
c:RegisterEffect(e4)
--special summon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(71645242,1))
e5:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_SZONE)
e5:SetTarget(c71645242.sptg2)
e5:SetOperation(c71645242.spop2)
c:RegisterEffect(e5)
end
function c71645242.spcon(e,tp,eg,ep,ev,re,r,rp)
function c71645242.regcon(e,tp,eg,ep,ev,re,r,rp)
if eg:GetFirst():GetSummonType()~=SUMMON_TYPE_SPECIAL+0x20 then
e:GetLabelObject():Clear()
e:GetLabelObject():Merge(eg)
local sf=0
if eg:IsExists(Card.IsControler,1,nil,tp) then
sf=sf+1
end
if eg:IsExists(Card.IsControler,1,nil,1-tp) then
sf=sf+2
end
e:SetLabel(sf)
return true
else return false end
end
function c71645242.regop(e,tp,eg,ep,ev,re,r,rp)
Duel.RaiseEvent(eg,71645242,e,r,rp,ep,e:GetLabel())
end
function c71645242.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsStatus(STATUS_CHAINING) end
Duel.SetTargetCard(e:GetLabelObject())
if chk==0 then return true end
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c71645242.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
local g=eg:Filter(Card.IsRelateToEffect,nil,e)
local tc=g:GetFirst()
if not tc then return end
local s0=false
local s1=false
while tc do
if tc:IsControler(tp) then s0=true
else s1=true end
if tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
......@@ -67,12 +73,12 @@ function c71645242.spop(e,tp,eg,ep,ev,re,r,rp)
end
tc=g:GetNext()
end
if s0 and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0
if bit.band(ev,0x1)~=0 and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,71645243,0,0x4011,800,800,2,RACE_PLANT,ATTRIBUTE_DARK,POS_FACEUP_ATTACK,1-tp) then
local token=Duel.CreateToken(tp,71645243)
Duel.SpecialSummonStep(token,0x20,tp,1-tp,false,false,POS_FACEUP_ATTACK)
end
if s1 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
if bit.band(ev,0x2)~=0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,71645243,0,0x4011,800,800,2,RACE_PLANT,ATTRIBUTE_DARK) then
local token=Duel.CreateToken(1-tp,71645243)
Duel.SpecialSummonStep(token,0x20,tp,tp,false,false,POS_FACEUP_ATTACK)
......
......@@ -81,7 +81,7 @@ end
function c74115234.retcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ec=c:GetPreviousEquipTarget()
return c:IsReason(REASON_LOST_TARGET) and (ec:GetLocation()==LOCATION_HAND)
return c:IsReason(REASON_LOST_TARGET) and ec and ec:IsLocation(LOCATION_HAND) and ec:GetPreviousControler()==tp
end
function c74115234.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
......
......@@ -71,7 +71,6 @@ function c74506079.regop(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c74506079.tgcost)
e1:SetTarget(c74506079.tgtg)
e1:SetOperation(c74506079.tgop)
......
......@@ -24,6 +24,8 @@ function c74841885.chkfilter(c,rac,att)
return c:IsRace(rac) and c:IsAttribute(att)
end
function c74841885.valcheck(e,c)
if e:GetLabel()~=1 then return end
e:SetLabel(0)
local g=c:GetMaterial()
local lbl=0
if g:IsExists(c74841885.chkfilter,1,nil,RACE_FAIRY,ATTRIBUTE_LIGHT) then
......@@ -32,7 +34,7 @@ function c74841885.valcheck(e,c)
if g:IsExists(c74841885.chkfilter,1,nil,RACE_FIEND,ATTRIBUTE_DARK) then
lbl=lbl+TYPE_TRAP
end
if e:GetLabel()==1 and lbl~=0 then
if lbl~=0 then
--disable
local e1=Effect.CreateEffect(c)
if lbl==TYPE_SPELL then
......
--ゴーストリックの雪女
--ゴーストリック・キョンシー
function c80885284.initial_effect(c)
--summon limit
local e1=Effect.CreateEffect(c)
......@@ -20,7 +20,7 @@ function c80885284.initial_effect(c)
e3:SetDescription(aux.Stringid(80885284,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CHAIN_UNIQUE)
e3:SetProperty(EFFECT_FLAG_CHAIN_UNIQUE+EFFECT_FLAG_DAMAGE_STEP)
e3:SetCode(EVENT_FLIP)
e3:SetCost(c80885284.thcost)
e3:SetTarget(c80885284.thtg)
......
......@@ -24,6 +24,7 @@ function c8794435.valcheck(e,c)
tc=g:GetNext()
end
if e:GetLabel()==1 then
e:SetLabel(0)
--atk continuous effect
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -66,6 +66,7 @@ function c88071625.valcheck(e,c)
tc=g:GetNext()
end
if e:GetLabel()==1 then
e:SetLabel(0)
--atk continuous effect
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -19,8 +19,9 @@ function c89662736.nacon(e,tp,eg,ep,ev,re,r,rp)
return at:IsControler(tp) and at:IsFaceup() and at:IsSetCard(0x88) and at:IsRace(RACE_BEASTWARRIOR)
end
function c89662736.nacost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
if chk==0 then return Duel.GetFlagEffect(tp,89662736)==0 and e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
Duel.RegisterFlagEffect(tp,89662736,RESET_PHASE+PHASE_END,0,1)
end
function c89662736.natg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
......
......@@ -6,6 +6,7 @@ function c91842653.initial_effect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c91842653.splimit)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
......@@ -58,6 +59,9 @@ function c91842653.initial_effect(c)
e8:SetOperation(c91842653.atop)
c:RegisterEffect(e8)
end
function c91842653.splimit(e,se,sp,st,spos,tgp)
return Duel.IsExistingMatchingCard(c91842653.cfilter,tgp,LOCATION_ONFIELD,0,1,nil)
end
function c91842653.cfilter(c)
return c:IsFaceup() and c:IsCode(15259703)
end
......
......@@ -4,7 +4,7 @@ function c93830681.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(93830681,0))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CHAIN_UNIQUE)
e1:SetCode(EVENT_BE_BATTLE_TARGET)
e1:SetRange(LOCATION_GRAVE)
e1:SetCondition(c93830681.condition)
......
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