Commit a0725032 authored by argon.sun's avatar argon.sun

new scripts

parent 2b06d328
......@@ -1160,9 +1160,11 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
adjust_instant();
if(target->material_cards.size()) {
for(auto mit = target->material_cards.begin(); mit != target->material_cards.end(); ++mit)
raise_single_event(*mit, EVENT_BE_MATERIAL, proc, 0, sumplayer, sumplayer, 0);
raise_single_event(*mit, EVENT_BE_MATERIAL, proc, REASON_SUMMON, sumplayer, sumplayer, 0);
}
raise_event(&target->material_cards, EVENT_BE_MATERIAL, proc, REASON_SUMMON, sumplayer, sumplayer, 0);
process_single_event();
process_instant_event();
return false;
}
case 17: {
......@@ -1635,11 +1637,15 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
case 16: {
pduel->write_buffer8(MSG_SPSUMMONED);
adjust_instant();
effect* proc = core.units.begin()->peffect;
int32 matreason = proc->value == SUMMON_TYPE_SYNCHRO ? REASON_SYNCHRO : proc->value == SUMMON_TYPE_XYZ ? REASON_XYZ : REASON_SPSUMMON;
if(target->material_cards.size()) {
for(auto mit = target->material_cards.begin(); mit != target->material_cards.end(); ++mit)
raise_single_event(*mit, EVENT_BE_MATERIAL, core.units.begin()->peffect, 0, sumplayer, sumplayer, 0);
raise_single_event(*mit, EVENT_BE_MATERIAL, proc, matreason, sumplayer, sumplayer, 0);
}
raise_event(&target->material_cards, EVENT_BE_MATERIAL, proc, matreason, sumplayer, sumplayer, 0);
process_single_event();
process_instant_event();
return false;
}
case 17: {
......@@ -1775,13 +1781,16 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl
for(cit = targets->container.begin(); cit != targets->container.end(); ++cit) {
if(!((*cit)->current.position & POS_FACEDOWN))
raise_single_event(*cit, EVENT_SPSUMMON_SUCCESS, (*cit)->current.reason_effect, 0, (*cit)->current.reason_player, (*cit)->summon_player, 0);
if(((*cit)->summon_type & 0x3000000) && (*cit)->material_cards.size()) {
card_set::iterator mit;
for(mit = (*cit)->material_cards.begin(); mit != (*cit)->material_cards.end(); ++mit)
raise_single_event(*mit, EVENT_BE_MATERIAL, core.reason_effect, 0, core.reason_player, (*cit)->summon_player, 0);
int32 summontype = (*cit)->summon_type & 0x3000000;
if(summontype && (*cit)->material_cards.size()) {
int32 matreason = (summontype & SUMMON_TYPE_FUSION) ? REASON_FUSION : (summontype & SUMMON_TYPE_RITUAL) ? REASON_RITUAL : 0;
for(auto mit = (*cit)->material_cards.begin(); mit != (*cit)->material_cards.end(); ++mit)
raise_single_event(*mit, EVENT_BE_MATERIAL, core.reason_effect, matreason, core.reason_player, (*cit)->summon_player, 0);
raise_event(&((*cit)->material_cards), EVENT_BE_MATERIAL, core.reason_effect, matreason, core.reason_player, (*cit)->summon_player, 0);
}
}
process_single_event();
process_instant_event();
return FALSE;
}
case 3: {
......
......@@ -11,6 +11,7 @@
#include "group.h"
#include "effect.h"
#include "interpreter.h"
#include "ocgapi.h"
void field::add_process(uint16 type, uint16 step, effect* peffect, group* target, ptr arg1, ptr arg2) {
processor_unit new_unit;
......@@ -2987,7 +2988,8 @@ int32 field::process_battle_command(uint16 step) {
pduel->write_buffer8(0);
}
core.units.begin()->peffect = damchange;
core.temp_var[0] = reason_card->current.controler;
if(reason_card)
core.temp_var[0] = reason_card->current.controler;
if(!reason_card)
core.temp_var[1] = 0;
else if(reason_card == core.attacker)
......
......@@ -10,7 +10,6 @@ function c10000030.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c10000030.cost)
e1:SetTarget(c10000030.target)
e1:SetOperation(c10000030.operation)
c:RegisterEffect(e1)
......@@ -18,14 +17,6 @@ end
function c10000030.xyzfilter(c)
return c:GetLevel()==6 and c:IsRace(RACE_SPELLCASTER)
end
function c10000030.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST)
and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_HAND,0,1,nil) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_HAND,0,1,1,nil)
Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)
end
function c10000030.filter1(c)
return c:IsControlerCanBeChanged()
end
......@@ -37,8 +28,10 @@ function c10000030.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if e:GetLabel()==0 then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c10000030.filter1(chkc)
else return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and c10000030.filter2(chkc,e,tp) end
end
if chk==0 then return Duel.IsExistingTarget(c10000030.filter1,tp,0,LOCATION_MZONE,1,nil)
or (Duel.GetLocationCount(tp,LOCATION_MZONE)~=0 and Duel.IsExistingTarget(c10000030.filter2,tp,0,LOCATION_GRAVE,1,nil,e,tp)) end
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST)
and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_HAND,0,1,nil)
and (Duel.IsExistingTarget(c10000030.filter1,tp,0,LOCATION_MZONE,1,nil)
or (Duel.GetLocationCount(tp,LOCATION_MZONE)~=0 and Duel.IsExistingTarget(c10000030.filter2,tp,0,LOCATION_GRAVE,1,nil,e,tp))) end
local b1=Duel.IsExistingTarget(c10000030.filter1,tp,0,LOCATION_MZONE,1,nil)
local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)~=0 and Duel.IsExistingTarget(c10000030.filter2,tp,0,LOCATION_GRAVE,1,nil,e,tp)
local op=0
......@@ -47,6 +40,10 @@ function c10000030.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(10000030,1))
else op=Duel.SelectOption(tp,aux.Stringid(10000030,2))+1 end
e:SetLabel(op)
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_HAND,0,1,1,nil)
Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)
if op==0 then
e:SetCategory(CATEGORY_CONTROL)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
......
......@@ -13,7 +13,7 @@ function c40844552.initial_effect(c)
c:RegisterEffect(e1)
end
function c40844552.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)<=1
return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)<=1
end
function c40844552.cfilter(c)
return c:IsSetCard(0x42) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
......
......@@ -74,6 +74,7 @@ function c45986603.rectg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,1-tp,1000)
end
function c45986603.recop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Recover(p,d,REASON_EFFECT)
end
......@@ -10,7 +10,6 @@ function c581014.initial_effect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c581014.cost)
e1:SetTarget(c581014.target)
e1:SetOperation(c581014.operation)
c:RegisterEffect(e1)
......@@ -21,17 +20,14 @@ end
function c581014.filter2(c,e,tp)
return not c:IsType(TYPE_EFFECT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c581014.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c581014.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then
if e:GetLabel()==0 then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c581014.filter1(c)
else return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c581014.filter2(c,e,tp) end
end
if chk==0 then return (Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(c581014.filter1,tp,LOCATION_GRAVE,0,3,nil))
or Duel.IsExistingTarget(c581014.filter2,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST)
and ((Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(c581014.filter1,tp,LOCATION_GRAVE,0,3,nil))
or Duel.IsExistingTarget(c581014.filter2,tp,LOCATION_GRAVE,0,1,nil,e,tp)) end
local op=0
local b1=Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(c581014.filter1,tp,LOCATION_GRAVE,0,3,nil)
local b2=Duel.IsExistingTarget(c581014.filter2,tp,LOCATION_GRAVE,0,1,nil,e,tp)
......@@ -41,6 +37,7 @@ function c581014.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
elseif b1 then
op=Duel.SelectOption(tp,aux.Stringid(581014,1))
else op=Duel.SelectOption(tp,aux.Stringid(581014,2))+1 end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
if op==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c581014.filter1,tp,LOCATION_GRAVE,0,3,3,nil)
......
......@@ -58,7 +58,7 @@ function c61777313.operation(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fc0000+RESET_PHASE+PHASE_END)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(e:GetLabel())
c:RegisterEffect(e1)
end
......
......@@ -49,6 +49,6 @@ function c72302403.desop(e,tp,eg,ep,ev,re,r,rp)
ct=ct+1
c:SetTurnCounter(ct)
if ct==3 then
Duel.Destroy(c,REASON_EFFECT)
Duel.Destroy(c,REASON_RULE)
end
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