Commit bfd953f4 authored by VanillaSalt's avatar VanillaSalt

fix

parent f05ed8d8
......@@ -2308,8 +2308,10 @@ int32 card::is_can_be_synchro_material(card* scard, card* tuner) {
return FALSE;
return TRUE;
}
int32 card::is_can_be_xyz_material(card* scard) {
if(data.type & (TYPE_XYZ | TYPE_TOKEN))
int32 card::is_can_be_xyz_material(card* scard, uint8 ignore_xyz) {
if(data.type & TYPE_TOKEN)
return FALSE;
if(!ignore_xyz && (data.type & TYPE_XYZ))
return FALSE;
if(!(get_type()&TYPE_MONSTER))
return FALSE;
......
......@@ -246,7 +246,7 @@ public:
int32 is_capable_be_effect_target(effect* peffect, uint8 playerid);
int32 is_can_be_fusion_material(uint8 ignore_mon = FALSE);
int32 is_can_be_synchro_material(card* scard, card* tuner = 0);
int32 is_can_be_xyz_material(card* scard);
int32 is_can_be_xyz_material(card* scard, uint8 ignore_xyz = FALSE);
};
//Locations
......
......@@ -1793,11 +1793,14 @@ int32 scriptlib::card_is_can_be_xyz_material(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
card* scard = 0;
if(lua_gettop(L) >= 2) {
if(lua_gettop(L) >= 2 && !lua_isnil(L, 2)) {
check_param(L, PARAM_TYPE_CARD, 2);
scard = *(card**) lua_touserdata(L, 2);
}
lua_pushboolean(L, pcard->is_can_be_xyz_material(scard));
uint32 ign = FALSE;
if(lua_gettop(L) >= 3)
ign = lua_toboolean(L, 3);
lua_pushboolean(L, pcard->is_can_be_xyz_material(scard, ign));
return 1;
}
int32 scriptlib::card_check_fusion_material(lua_State *L) {
......
......@@ -11,6 +11,7 @@
#include "card.h"
#include "effect.h"
#include "group.h"
#include "ocgapi.h"
int32 scriptlib::duel_enable_global_flag(lua_State *L) {
check_param_count(L, 1);
......@@ -2884,15 +2885,24 @@ int32 scriptlib::duel_is_player_can_spsummon_monster(lua_State * L) {
lua_pushboolean(L, 0);
return 1;
}
int32 code = lua_tointeger(L, 2);
card_data dat;
dat.code = lua_tointeger(L, 2);
::read_card(code, &dat);
dat.code = code;
dat.alias = 0;
if(!lua_isnil(L, 3))
dat.setcode = lua_tointeger(L, 3);
if(!lua_isnil(L, 4))
dat.type = lua_tointeger(L, 4);
if(!lua_isnil(L, 5))
dat.attack = lua_tointeger(L, 5);
if(!lua_isnil(L, 6))
dat.defence = lua_tointeger(L, 6);
if(!lua_isnil(L, 7))
dat.level = lua_tointeger(L, 7);
if(!lua_isnil(L, 8))
dat.race = lua_tointeger(L, 8);
if(!lua_isnil(L, 9))
dat.attribute = lua_tointeger(L, 9);
int32 pos = POS_FACEUP;
int32 toplayer = playerid;
......
......@@ -42,6 +42,7 @@ function c12525049.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c12525049.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c12525049.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
......
......@@ -49,7 +49,7 @@ function c13647631.spop(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetValue(atk/2)
e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+RESET_END)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_BASE_DEFENCE)
......
......@@ -4,7 +4,7 @@ function c13683298.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c13683298.condition)
e1:SetCost(c13683298.cost)
......
......@@ -19,9 +19,11 @@ function c1516510.fsop(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
local g1=nil
local g2=nil
if gc then
g1=Group.CreateGroup()
g1=Group.FromCards(gc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
g2=eg:FilterSelect(tp,Card.IsRace,1,1,nil,RACE_SPELLCASTER)
Duel.SetFusionMaterial(g2)
g1:Merge(g2)
else
local sg1=Group.CreateGroup()
local sg2=Group.CreateGroup()
......@@ -57,9 +59,9 @@ function c1516510.fsop(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
g2=sg2:Select(tp,1,1,g1:GetFirst())
end
end
g1:Merge(g2)
Duel.SetFusionMaterial(g1)
end
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -64,7 +64,7 @@ function c25704359.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
local g=eg:Filter(c25704359.cfilter,nil,tp)
local att=0
local att=0x7f
local tc=g:GetFirst()
while tc do
att=bit.band(att,tc:GetOriginalAttribute())
......
......@@ -8,6 +8,7 @@ function c30312361.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c30312361.cost)
e1:SetTarget(c30312361.target)
e1:SetOperation(c30312361.operation)
c:RegisterEffect(e1)
......@@ -17,8 +18,12 @@ function c30312361.initial_effect(c)
e2:SetCode(EFFECT_NO_BATTLE_DAMAGE)
c:RegisterEffect(e2)
end
function c30312361.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(30312361)==0 end
e:GetHandler():RegisterFlagEffect(30312361,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c30312361.filter(c)
return c:IsType(TYPE_EFFECT) and not c:IsHasEffect(EFFECT_FORBIDDEN) and c:IsAbleToRemove()
return c:IsType(TYPE_EFFECT) and not c:IsForbidden() and c:IsAbleToRemove()
end
function c30312361.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c30312361.filter(chkc) end
......
......@@ -39,5 +39,5 @@ function c49032236.operation(e,tp,eg,ep,ev,re,r,rp)
end
end
function c49032236.efilter(e,re)
return e:GetHandler()~=re:GetHandler()
return e:GetHandler()~=re:GetOwner()
end
......@@ -14,6 +14,7 @@ function c49919798.initial_effect(c)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1)
e2:SetCost(c49919798.cpcost)
e2:SetTarget(c49919798.cptg)
e2:SetOperation(c49919798.cpop)
c:RegisterEffect(e2)
......@@ -43,6 +44,10 @@ function c49919798.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmCards(1-tp,g)
end
end
function c49919798.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(49919798)==0 end
e:GetHandler():RegisterFlagEffect(49919798,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c49919798.cpfilter(c)
return c:IsFaceup() and c:IsSetCard(0x66) and not c:IsCode(49919798)
end
......
......@@ -78,5 +78,6 @@ function c51194046.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,c51194046[tp])
end
function c51194046.drop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Draw(tp,c51194046[tp],REASON_EFFECT)
end
......@@ -35,13 +35,13 @@ function c66127916.activate(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tg=Duel.SelectMatchingCard(tp,c66127916.filter3,tp,LOCATION_GRAVE,0,1,1,nil)
local tc=tg:GetFirst()
if tc and Duel.SelectYesNo(tp,aux.Stringid(66127916,0)) then
local tg=Duel.GetMatchingGroup(c66127916.filter3,tp,LOCATION_GRAVE,0,nil)
if tg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(66127916,0)) then
Duel.BreakEffect()
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=tg:Select(tp,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
end
......@@ -17,19 +17,19 @@ end
function c81210420.filter(c)
return not c:IsType(TYPE_TOKEN)
end
function c81210420.spfilter(c,e,tp)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and Duel.IsPlayerCanSpecialSummonMonster(tp,c:GetCode(),0,0x11,0,0,0,0,0)
function c81210420.spfilter(c,tp)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and Duel.IsPlayerCanSpecialSummonMonster(tp,c:GetCode(),nil,0x11,0,0,0,0,0)
end
function c81210420.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c81210420.filter,tp,LOCATION_MZONE,0,1,nil)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1
and Duel.IsExistingMatchingCard(c81210420.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp)
and Duel.IsExistingMatchingCard(c81210420.spfilter,tp,LOCATION_DECK,0,2,nil,tp)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK)
end
function c81210420.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
local g=Duel.GetMatchingGroup(c81210420.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
local g=Duel.GetMatchingGroup(c81210420.spfilter,tp,LOCATION_DECK,0,nil,tp)
if g:GetCount()<2 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local tc=Duel.SelectMatchingCard(tp,c81210420.filter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
......
......@@ -42,7 +42,7 @@ function c8437145.activate(e,tp,eg,ep,ev,re,r,rp)
end
end
function c8437145.efilter(e,re)
return e:GetOwnerPlayer()~=re:GetHandlerPlayer()
return e:GetOwnerPlayer()~=re:GetOwnerPlayer()
end
function c8437145.repfilter(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE)
......
......@@ -35,7 +35,7 @@ function c94432298.tgtg1(e,tp,eg,ep,ev,re,r,rp,chk)
and Duel.IsExistingMatchingCard(c94432298.filter,tp,LOCATION_DECK,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(94432298,0)) then
e:SetCategory(CATEGORY_TOGRAVE)
e:GetHandler():RegisterFlagEffect(94432298,RESET_PHASE+RESET_END,0,1)
e:GetHandler():RegisterFlagEffect(94432298,RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END,0,1)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
else
e:SetCategory(0)
......@@ -46,7 +46,7 @@ function c94432298.tgcon(e,tp,eg,ep,ev,re,r,rp)
end
function c94432298.tgcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(94432298)==0 end
e:GetHandler():RegisterFlagEffect(94432298,RESET_PHASE+RESET_END,0,1)
e:GetHandler():RegisterFlagEffect(94432298,RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END,0,1)
end
function c94432298.filter(c)
return c:IsSetCard(0xbb) and c:IsAbleToGrave()
......
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