Commit 5431ae83 authored by argon.sun's avatar argon.sun

fix

parent 147d0098
......@@ -57,8 +57,10 @@ void ClientCard::UpdateInfo(char* buf) {
} else
code = pdata;
}
if(flag & QUERY_POSITION)
if(flag & QUERY_POSITION) {
pdata = BufferIO::ReadInt32(buf);
position = (pdata >> 24) & 0xff;
}
if(flag & QUERY_ALIAS)
alias = BufferIO::ReadInt32(buf);
if(flag & QUERY_TYPE)
......
......@@ -853,14 +853,14 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
}
int oseq = pcard->overlayTarget->sequence;
if (pcard->overlayTarget->controler == 0) {
t->X = 1.75f + 1.1f * oseq - 0.08f + 0.04f * sequence;
t->X = 1.75f + 1.1f * oseq - 0.12f + 0.06f * sequence;
t->Y = 1.15f;
t->Z = 0.005f + pcard->sequence * 0.0001f;
r->X = 0.0f;
r->Y = 0.0f;
r->Z = 0.0f;
} else {
t->X = 6.15f - 1.1f * oseq + 0.08f - 0.04f * sequence;
t->X = 6.15f - 1.1f * oseq + 0.12f - 0.06f * sequence;
t->Y = -1.15f;
t->Z = 0.005f + pcard->sequence * 0.0001f;
r->X = 0.0f;
......
......@@ -1551,6 +1551,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_SHUFFLE_DECK: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
if(mainGame->dField.deck[player].size() < 2)
return true;
bool rev = mainGame->dField.deck_reversed;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->dField.deck_reversed = false;
......
......@@ -614,18 +614,15 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_MZONE, seq);
ccard->position = BufferIO::ReadInt8(pbuf);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
val = BufferIO::ReadInt8(pbuf);
if(val) {
for(int xyz = 0; xyz < val; ++xyz) {
ClientCard* xcard = new ClientCard;
ccard->overlayed.push_back(xcard);
mainGame->dField.overlay_cards.insert(xcard);
mainGame->gMutex.Unlock();
xcard->overlayTarget = ccard;
xcard->location = 0x80;
xcard->sequence = ccard->overlayed.size() - 1;
mainGame->dField.GetCardLocation(xcard, &xcard->curPos, &xcard->curRot, true);
}
}
}
......@@ -636,42 +633,37 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_SZONE, seq);
ccard->position = BufferIO::ReadInt8(pbuf);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
}
val = BufferIO::ReadInt8(pbuf);
for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_DECK, seq);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
val = BufferIO::ReadInt8(pbuf);
for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_HAND, seq);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
val = BufferIO::ReadInt8(pbuf);
for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_GRAVE, seq);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
val = BufferIO::ReadInt8(pbuf);
for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_REMOVED, seq);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
val = BufferIO::ReadInt8(pbuf);
for(int seq = 0; seq < val; ++seq) {
ClientCard* ccard = new ClientCard;
mainGame->dField.AddCard(ccard, p, LOCATION_EXTRA, seq);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
}
mainGame->gMutex.Unlock();
SinglePlayReload();
mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock();
break;
}
case MSG_AI_NAME: {
......
......@@ -1288,6 +1288,8 @@ void field::adjust_disable_check_list() {
int32 field::check_lp_cost(uint8 playerid, uint32 lp) {
effect_set eset;
int32 val = lp;
if(lp == 0)
return TRUE;
filter_player_effect(playerid, EFFECT_LPCOST_CHANGE, &eset);
for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
......
......@@ -928,8 +928,6 @@ int32 scriptlib::duel_pay_lp_cost(lua_State *L) {
if(playerid != 0 && playerid != 1)
return 0;
uint32 cost = lua_tointeger(L, 2);
if(cost == 0)
return 0;
duel* pduel = interpreter::get_duel_info(L);
pduel->game_field->add_process(PROCESSOR_PAY_LPCOST, 0, 0, 0, playerid, cost);
return lua_yield(L, 0);
......
......@@ -504,6 +504,11 @@ int32 field::pay_lp_cost(uint32 step, uint8 playerid, uint32 cost) {
case 0: {
effect_set eset;
int32 val = cost;
if(cost == 0) {
raise_event((card*)0, EVENT_PAY_LPCOST, core.reason_effect, 0, playerid, playerid, cost);
process_instant_event();
return TRUE;
}
filter_player_effect(playerid, EFFECT_LPCOST_CHANGE, &eset);
for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
......@@ -2843,7 +2848,8 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret
return TRUE;
if(!(location == LOCATION_SZONE && (target->data.type & TYPE_FIELD) && (target->data.type & TYPE_SPELL))) {
uint32 flag;
uint32 ct = get_useable_count(playerid, location, move_player, LOCATION_REASON_TOFIELD, &flag);
uint32 lreason = (target->current.location == LOCATION_MZONE) ? LOCATION_REASON_CONTROL : LOCATION_REASON_TOFIELD;
uint32 ct = get_useable_count(playerid, location, move_player, lreason, &flag);
if(ret && (ct <= 0 || !(target->data.type & TYPE_MONSTER))) {
core.units.begin()->step = 3;
send_to(target, core.reason_effect, REASON_EFFECT, core.reason_player, PLAYER_NONE, LOCATION_GRAVE, 0, 0);
......
......@@ -25,6 +25,7 @@ function c11868731.initial_effect(c)
end
function c11868731.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp
and e:GetHandler():GetPreviousControler()==tp
end
function c11868731.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -22,6 +22,7 @@ function c12980373.initial_effect(c)
end
function c12980373.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp
and e:GetHandler():GetPreviousControler()==tp
end
function c12980373.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -59,7 +59,7 @@ function c1992816.olop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()>1 then
if g:GetCount()>0 then
Duel.Overlay(c,g)
end
end
......
......@@ -9,6 +9,7 @@ function c20174189.initial_effect(c)
--summon success
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetCondition(c20174189.regcon)
e2:SetOperation(c20174189.regop)
......@@ -23,19 +24,18 @@ function c20174189.valcheck(e,c)
end
function c20174189.regcon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_ADVANCE)==SUMMON_TYPE_ADVANCE
and e:GetLabelObject():GetLabel()~=0
end
function c20174189.regop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabelObject():GetLabel()~=0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(0,1)
e1:SetValue(c20174189.aclimit)
e1:SetReset(RESET_EVENT+0x1fe0000)
e:GetHandler():RegisterEffect(e1)
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(0,1)
e1:SetValue(c20174189.aclimit)
e1:SetReset(RESET_EVENT+0x1fe0000)
e:GetHandler():RegisterEffect(e1)
end
function c20174189.aclimit(e,re,tp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE)
......
......@@ -23,6 +23,7 @@ function c26016357.initial_effect(c)
end
function c26016357.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp
and e:GetHandler():GetPreviousControler()==tp
end
function c26016357.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -21,6 +21,7 @@ function c3989465.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
local c=e:GetHandler()
return (ph==PHASE_DAMAGE or ph==PHASE_DAMAGE_CAL) and (c==Duel.GetAttacker() or c==Duel.GetAttackTarget())
and not Duel.IsDamageCalculated()
end
function c3989465.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(3989465)==0 and e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
......
......@@ -11,10 +11,10 @@ function c45141844.initial_effect(c)
c:RegisterEffect(e1)
end
function c45141844.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetLocation()==LOCATION_MZONE and chkc:GetControler()~=tp and chkc:IsDestructable() end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsDestructable() end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,0,LOCATION_MZONE,1,1,nil,tp)
local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c45141844.operation(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -23,6 +23,7 @@ function c48252330.initial_effect(c)
end
function c48252330.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp
and e:GetHandler():GetPreviousControler()==tp
end
function c48252330.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -7,11 +7,11 @@ function c49221191.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(49221191,1))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetHintTiming(TIMING_BATTLE_PHASE)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetCondition(c49221191.condition)
e1:SetCost(c49221191.cost)
e1:SetTarget(c49221191.target)
......@@ -25,7 +25,7 @@ function c49221191.ovfilter(c)
return c:IsFaceup() and c:IsCode(65676461)
end
function c49221191.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLP(tp)<=1000
return Duel.GetLP(tp)<=1000 and (Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated())
end
function c49221191.rfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
......@@ -39,7 +39,7 @@ function c49221191.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c49221191.filter(c)
return c:IsFaceup() and c:GetAttack()>0
return c:IsFaceup() and (c:GetAttack()>0 or c:GetDefence()>0)
end
function c49221191.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c49221191.filter(chkc) end
......
......@@ -24,6 +24,7 @@ function c49374988.initial_effect(c)
end
function c49374988.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp
and e:GetHandler():GetPreviousControler()==tp
end
function c49374988.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -24,6 +24,7 @@ function c52404456.initial_effect(c)
end
function c52404456.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp
and e:GetHandler():GetPreviousControler()==tp
end
function c52404456.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -6,16 +6,18 @@ function c55727845.initial_effect(c)
--atk u/d
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(55727845,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c55727845.atkcost)
e1:SetTarget(c55727845.atktg1)
e1:SetOperation(c55727845.atkop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(55727845,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_BE_BATTLE_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c55727845.atkcost)
e2:SetTarget(c55727845.atktg2)
e2:SetOperation(c55727845.atkop)
......@@ -27,20 +29,17 @@ function c55727845.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c55727845.atktg1(e,tp,eg,ep,ev,re,r,rp,chk)
local at=Duel.GetAttackTarget()
if chk==0 then return at and at:IsFaceup() end
at:CreateEffectRelation(e)
e:SetLabelObject(at)
if chk==0 then return at and at:IsFaceup() and Duel.GetAttacker()==e:GetHandler() and not e:GetHandler():IsStatus(STATUS_CHAINING) end
Duel.SetTargetCard(at)
end
function c55727845.atktg2(e,tp,eg,ep,ev,re,r,rp,chk)
local at=Duel.GetAttacker()
if chk==0 then return true end
at:CreateEffectRelation(e)
e:SetLabelObject(at)
if chk==0 then return Duel.GetAttackTarget()==e:GetHandler() and not e:GetHandler():IsStatus(STATUS_CHAINING) end
Duel.SetTargetCard(Duel.GetAttacker())
end
function c55727845.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetLabelObject()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsFaceup() then
local atk=tc:GetAttack()/2
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......@@ -50,6 +49,8 @@ function c55727845.atkop(e,tp,eg,ep,ev,re,r,rp)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(atk)
e2:SetReset(RESET_EVENT+0x1ff0000)
......
......@@ -5,7 +5,7 @@ function c60202749.initial_effect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetHintTiming(0,TIMING_END_PHASE+TIMING_MAIN_END)
e1:SetTarget(c60202749.target)
e1:SetOperation(c60202749.operation)
c:RegisterEffect(e1)
......
......@@ -36,6 +36,7 @@ function c74641045.initial_effect(c)
end
function c74641045.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp
and e:GetHandler():GetPreviousControler()==tp
end
function c74641045.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -22,6 +22,7 @@ function c75363626.initial_effect(c)
end
function c75363626.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp
and e:GetHandler():GetPreviousControler()==tp
end
function c75363626.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -24,6 +24,7 @@ function c89521713.initial_effect(c)
end
function c89521713.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp
and e:GetHandler():GetPreviousControler()==tp
end
function c89521713.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -242,7 +242,6 @@ function Auxiliary.XyzOperation2(f,minc,alterf,desc)
Duel.Overlay(c,mg2)
end
Duel.Overlay(c,mg)
mg:Merge(mg2)
c:SetMaterial(mg)
else
local mg=g:FilterSelect(tp,f,minc,minc,nil)
......
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