Commit 6e603d07 authored by unknown's avatar unknown

bug fix

parent ceda6654
......@@ -2175,6 +2175,8 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
mainGame->gMutex.Lock();
mainGame->dField.RemoveCard(pc, pl, ps);
mainGame->gMutex.Unlock();
if(pcard == mainGame->dField.hovered_card)
mainGame->dField.hovered_card = 0;
delete pcard;
} else {
if (!(pl & 0x80) && !(cl & 0x80)) {
......
......@@ -247,6 +247,9 @@ int32 effect::is_activate_ready(uint8 playerid, event e, int32 neglect_cond, int
return TRUE;
}
int32 effect::is_condition_check(uint8 playerid, event e) {
if ((handler->current.location & LOCATION_ONFIELD)
&& (!handler->is_position(POS_FACEUP) || !handler->is_status(STATUS_EFFECT_ENABLED)))
return FALSE;
if(!condition)
return TRUE;
effect* oreason = pduel->game_field->core.reason_effect;
......
......@@ -148,6 +148,7 @@ public:
#define EFFECT_FLAG_OATH 0x80000 //
#define EFFECT_FLAG_SPSUM_PARAM 0x100000 //
#define EFFECT_FLAG_REPEAT 0x200000 //
#define EFFECT_FLAG_NO_TURN_RESET 0x400000 //
//========== Codes ==========
#define EFFECT_IMMUNE_EFFECT 1 //
......
......@@ -44,9 +44,9 @@ struct optarget {
};
struct chain {
typedef std::map<uint32, optarget > opmap;
uint32 chain_type;
uint16 chain_id;
uint8 chain_count;
uint8 chain_type;
uint8 triggering_player;
uint8 triggering_controler;
uint8 triggering_location;
......@@ -476,7 +476,8 @@ public:
#define CHAININFO_DISABLE_REASON 0x200
#define CHAININFO_DISABLE_PLAYER 0x400
#define CHAININFO_CHAIN_ID 0x800
#define CHAININFO_CHAIN_TYPE 0x1000
#define CHAININFO_TYPE 0x1000
#define CHAININFO_EXTTYPE 0x2000
//Timing
#define TIMING_DRAW_PHASE 0x1
#define TIMING_STANDBY_PHASE 0x2
......
......@@ -662,7 +662,7 @@ int32 interpreter::call_function(int32 f, uint32 param_count, uint32 ret_count)
return OPERATION_FAIL;
}
if (param_count != params.size()) {
sprintf(pduel->strbuffer, "\"CallFunction\": incorrect parameter count (%d expected, %ld pushed)", param_count, params.size());
sprintf(pduel->strbuffer, "\"CallFunction\": incorrect parameter count (%d expected, %d pushed)", param_count, params.size());
handle_message(pduel, 1);
params.clear();
return OPERATION_FAIL;
......
......@@ -1216,7 +1216,10 @@ int32 scriptlib::duel_get_chain_info(lua_State *L) {
case CHAININFO_CHAIN_ID:
lua_pushinteger(L, ch->chain_id);
break;
case CHAININFO_CHAIN_TYPE:
case CHAININFO_TYPE:
lua_pushinteger(L, (ch->chain_type & 0x7));
break;
case CHAININFO_EXTTYPE:
lua_pushinteger(L, ch->chain_type);
break;
default:
......
......@@ -1419,7 +1419,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card * target, effect * proc, ui
adjust_all();
if(core.current_chain.size() == 0) {
core.hint_timing[setplayer] |= TIMING_MSET;
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, infos.turn_player);
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, FALSE);
}
return TRUE;
}
......@@ -1481,7 +1481,7 @@ int32 field::sset(uint16 step, uint8 setplayer, card * target) {
adjust_all();
if(core.current_chain.size() == 0) {
core.hint_timing[setplayer] |= TIMING_SSET;
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, infos.turn_player);
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, FALSE);
}
}
}
......
......@@ -3176,14 +3176,12 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
case 0: {
//Pre Draw
card* pcard;
event_list::iterator elit;
for(elit = core.used_event.begin(); elit != core.used_event.end(); ++elit) {
for(auto elit = core.used_event.begin(); elit != core.used_event.end(); ++elit) {
if(elit->event_cards)
pduel->delete_group((group*)elit->event_cards);
}
core.used_event.clear();
std::set<effect*>::iterator eit;
for(eit = core.reseted_effects.begin(); eit != core.reseted_effects.end(); ++eit) {
for(auto eit = core.reseted_effects.begin(); eit != core.reseted_effects.end(); ++eit) {
pduel->delete_effect(*eit);
}
core.reseted_effects.clear();
......@@ -3214,8 +3212,9 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
core.spsummon_state[p] = 0;
core.attack_state[p] = 0;
}
for(field_effect::effect_collection::iterator rit = effects.rechargeable.begin(); rit != effects.rechargeable.end(); ++rit)
(*rit)->recharge();
for(auto rit = effects.rechargeable.begin(); rit != effects.rechargeable.end(); ++rit)
if(!((*rit)->flag & EFFECT_FLAG_NO_TURN_RESET))
(*rit)->recharge();
infos.turn_id++;
core.summon_count[0] = 0;
core.summon_count[1] = 0;
......@@ -3451,7 +3450,7 @@ int32 field::add_chain(uint16 step) {
core.chain_limit = 0;
if(!(peffect->flag & EFFECT_FLAG_FIELD_ONLY) && peffect->handler->is_affected_by_effect(EFFECT_DISABLE_EFFECT))
clit->flag |= CHAIN_DISABLE_EFFECT;
clit->chain_type = peffect->handler->get_type() & 0x7;
clit->chain_type = peffect->handler->get_type();
clit->chain_count = core.current_chain.size() + 1;
clit->target_cards = 0;
clit->target_player = PLAYER_NONE;
......
--ゼンマイソルジャー
function c12299841.initial_effect(c)
--atk/lv up
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(12299841,0))
e1:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetOperation(c12299841.operation)
c:RegisterEffect(e1)
end
function c12299841.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END)
e1:SetValue(400)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_LEVEL)
e2:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END)
e2:SetValue(1)
c:RegisterEffect(e2)
end
end
......@@ -33,13 +33,13 @@ function c23874409.spfilter(c,e,tp)
end
function c23874409.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c23874409.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
and Duel.IsExistingMatchingCard(c23874409.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c23874409.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c23874409.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local g=Duel.SelectMatchingCard(tp,c23874409.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
......
......@@ -17,11 +17,11 @@ function c52035300.initial_effect(c)
c:RegisterEffect(e2)
--Special Summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(52035300,0))
e3:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetRange(LOCATION_GRAVE)
e3:SetDescription(aux.Stringid(52035300,0))
e3:SetCondition(c52035300.condition)
e3:SetTarget(c52035300.target)
e3:SetOperation(c52035300.operation)
......@@ -31,7 +31,7 @@ function c52035300.recon(e,c)
return not c:IsRace(RACE_WARRIOR)
end
function c52035300.filter(c)
return not c:IsRace(RACE_WARRIOR)
return c:IsType(TYPE_MONSTER) and not c:IsRace(RACE_WARRIOR)
end
function c52035300.condition(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0
......
......@@ -48,6 +48,12 @@ function c56768355.indcon(e)
return e:GetHandler():GetEquipCount()>0
end
function c56768355.indval(e,re)
local ty=re:GetOwner():GetType()
return bit.band(ty,TYPE_SPELL+TYPE_TRAP)~=0 and bit.band(ty,TYPE_EQUIP)==0
if not re then return false end
if re:IsHasType(EFFECT_TYPE_CONTINUOUS) then
local ty=re:GetOwner():GetType()
return bit.band(ty,TYPE_SPELL+TYPE_TRAP)~=0 and bit.band(ty,TYPE_EQUIP)==0
else
local ty=Duel.GetChainInfo(0,CHAININFO_EXTTYPE)
return bit.band(ty,TYPE_SPELL+TYPE_TRAP)~=0 and bit.band(ty,TYPE_EQUIP)==0
end
end
--ゼンマイマジシャン
function c59297550.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(59297550,0))
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_NO_TURN_RESET)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetCountLimit(1)
e1:SetCondition(c59297550.spcon)
e1:SetTarget(c59297550.sptg)
e1:SetOperation(c59297550.spop)
c:RegisterEffect(e1)
end
function c59297550.spcon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
return Duel.GetChainInfo(ev,CHAININFO_TYPE)==TYPE_MONSTER
and re:GetHandler():IsSetCard(0x58) and re:GetHandler():GetCode()~=59297550
end
function c59297550.filter(c,e,tp)
return c:IsSetCard(0x58) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c59297550.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsFaceup() and c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c59297550.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c59297550.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c59297550.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENCE)
end
end
......@@ -35,13 +35,13 @@ function c66976526.spfilter(c,e,tp)
end
function c66976526.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c66976526.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
and Duel.IsExistingMatchingCard(c66976526.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c66976526.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c66976526.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local g=Duel.SelectMatchingCard(tp,c66976526.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
......@@ -55,7 +55,7 @@ function c66976526.drcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c85541675.cfilter,1,nil,tp)
end
function c66976526.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsStatus(STATUs_CHAINING) and Duel.IsPlayerCanDraw(tp,1) end
if chk==0 then return not e:GetHandler():IsStatus(STATUS_CHAINING) and Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
......
......@@ -31,7 +31,7 @@ function c72677437.splimit(e,se,sp,st)
return not se:GetHandler():IsType(TYPE_MONSTER)
end
function c72677437.atkval(e,c)
return Duel.GetMatchingGroupCount(Card.IsRace,tp,LOCATION_GRAVE,0,nil,RACE_REPTILE)*500
return Duel.GetMatchingGroupCount(Card.IsRace,c:GetControler(),LOCATION_GRAVE,0,nil,RACE_REPTILE)*500
end
function c72677437.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE)
......
......@@ -47,7 +47,7 @@ function c8062132.initial_effect(c)
c:RegisterEffect(e6)
end
function c8062132.atkval(e,c)
return Duel.GetMatchingGroupCount(Card.IsRace,tp,LOCATION_GRAVE,0,nil,RACE_REPTILE)*500
return Duel.GetMatchingGroupCount(Card.IsRace,c:GetControler(),LOCATION_GRAVE,0,nil,RACE_REPTILE)*500
end
function c8062132.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE)
......
......@@ -165,6 +165,7 @@ CHAININFO_DISABLE_REASON =0x200
CHAININFO_DISABLE_PLAYER =0x400
CHAININFO_CHAIN_ID =0x800
CHAININFO_TYPE =0x1000
CHAININFO_EXTTYPE =0x2000
--========== Reset ==========
RESET_DRAW =PHASE_DRAW
RESET_STANDBY =PHASE_STANDBY
......@@ -229,6 +230,7 @@ EFFECT_FLAG_UNCOPYABLE =0x40000 --
EFFECT_FLAG_OATH =0x80000 --
EFFECT_FLAG_SPSUM_PARAM =0x100000 --
EFFECT_FLAG_REPEAT =0x200000 --
EFFECT_FLAG_NO_TURN_RESET =0x400000 --
--========== Codes ==========
EFFECT_IMMUNE_EFFECT =1 --
EFFECT_DISABLE =2 --
......
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