Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluorohydride committed Apr 24, 2012
1 parent 856a434 commit 60b9769
Show file tree
Hide file tree
Showing 323 changed files with 1,269 additions and 403 deletions.
2 changes: 1 addition & 1 deletion ocgcore/effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ class effect {
#define EVENT_CHAIN_ACTIVATING 1021
#define EVENT_CHAIN_SOLVED 1022
#define EVENT_CHAIN_ACTIVATED 1023
#define EVENT_CHAIN_INACTIVATED 1024
#define EVENT_CHAIN_NEGATED 1024
#define EVENT_CHAIN_DISABLED 1025
#define EVENT_CHAIN_END 1026
#define EVENT_CHAINING 1027
Expand Down
2 changes: 1 addition & 1 deletion ocgcore/field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ int32 field::is_player_can_remove(uint8 playerid, card * pcard) {
}
return TRUE;
}
int32 field::is_chain_inactivatable(uint8 chaincount) {
int32 field::is_chain_negatable(uint8 chaincount) {
effect_set eset;
if(chaincount < 0 && chaincount > core.current_chain.size())
return FALSE;
Expand Down
2 changes: 1 addition & 1 deletion ocgcore/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class field {
int32 is_player_can_send_to_hand(uint8 playerid, card* pcard);
int32 is_player_can_send_to_deck(uint8 playerid, card* pcard);
int32 is_player_can_remove(uint8 playerid, card* pcard);
int32 is_chain_inactivatable(uint8 chaincount);
int32 is_chain_negatable(uint8 chaincount);
int32 is_chain_disablable(uint8 chaincount);
int32 check_chain_target(uint8 chaincount, card* pcard);

Expand Down
6 changes: 3 additions & 3 deletions ocgcore/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ static const struct luaL_Reg cardlib[] = {
{ "IsAttackable", scriptlib::card_is_attackable },
{ "IsChainAttackable", scriptlib::card_is_chain_attackable },
{ "IsFaceup", scriptlib::card_is_faceup },
{ "IsAttack", scriptlib::card_is_attack },
{ "IsAttackPos", scriptlib::card_is_attack_pos },
{ "IsFacedown", scriptlib::card_is_facedown },
{ "IsDefence", scriptlib::card_is_defence },
{ "IsDefencePos", scriptlib::card_is_defence_pos },
{ "IsPosition", scriptlib::card_is_position },
{ "IsPreviousPosition", scriptlib::card_is_pre_position },
{ "IsControler", scriptlib::card_is_controler },
Expand Down Expand Up @@ -434,7 +434,7 @@ static const struct luaL_Reg duellib[] = {
{ "IsPlayerCanSendtoHand", scriptlib::duel_is_player_can_send_to_hand },
{ "IsPlayerCanSendtoGrave", scriptlib::duel_is_player_can_send_to_grave },
{ "IsPlayerCanSendtoDeck", scriptlib::duel_is_player_can_send_to_deck },
{ "IsChainInactivatable", scriptlib::duel_is_chain_inactivatable },
{ "IsChainNegatable", scriptlib::duel_is_chain_negatable },
{ "IsChainDisablable", scriptlib::duel_is_chain_disablable },
{ "CheckChainTarget", scriptlib::duel_check_chain_target },
{ "CheckChainUniqueness", scriptlib::duel_check_chain_uniqueness },
Expand Down
4 changes: 2 additions & 2 deletions ocgcore/libcard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ int32 scriptlib::card_is_faceup(lua_State *L) {
lua_pushboolean(L, pcard->is_position(POS_FACEUP));
return 1;
}
int32 scriptlib::card_is_attack(lua_State *L) {
int32 scriptlib::card_is_attack_pos(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
Expand All @@ -1228,7 +1228,7 @@ int32 scriptlib::card_is_facedown(lua_State *L) {
lua_pushboolean(L, pcard->is_position(POS_FACEDOWN));
return 1;
}
int32 scriptlib::card_is_defence(lua_State *L) {
int32 scriptlib::card_is_defence_pos(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
Expand Down
12 changes: 8 additions & 4 deletions ocgcore/libduel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,9 @@ int32 scriptlib::duel_damage(lua_State *L) {
uint32 playerid = lua_tointeger(L, 1);
if(playerid != 0 && playerid != 1)
return 0;
uint32 amount = lua_tointeger(L, 2);
int32 amount = lua_tointeger(L, 2);
if(amount < 0)
amount = 0;
uint32 reason = lua_tointeger(L, 3);
duel* pduel = interpreter::get_duel_info(L);
pduel->game_field->damage(pduel->game_field->core.reason_effect, reason, pduel->game_field->core.reason_player, 0, playerid, amount);
Expand All @@ -783,7 +785,9 @@ int32 scriptlib::duel_recover(lua_State *L) {
uint32 playerid = lua_tointeger(L, 1);
if(playerid != 0 && playerid != 1)
return 0;
uint32 amount = lua_tointeger(L, 2);
int32 amount = lua_tointeger(L, 2);
if(amount < 0)
amount = 0;
uint32 reason = lua_tointeger(L, 3);
duel* pduel = interpreter::get_duel_info(L);
pduel->game_field->recover(pduel->game_field->core.reason_effect, reason, pduel->game_field->core.reason_player, playerid, amount);
Expand Down Expand Up @@ -2679,11 +2683,11 @@ int32 scriptlib::duel_is_player_can_send_to_deck(lua_State * L) {
lua_pushboolean(L, pduel->game_field->is_player_can_send_to_deck(playerid, pcard));
return 1;
}
int32 scriptlib::duel_is_chain_inactivatable(lua_State * L) {
int32 scriptlib::duel_is_chain_negatable(lua_State * L) {
check_param_count(L, 1);
int32 chaincount = lua_tointeger(L, 1);
duel* pduel = interpreter::get_duel_info(L);
lua_pushboolean(L, pduel->game_field->is_chain_inactivatable(chaincount));
lua_pushboolean(L, pduel->game_field->is_chain_negatable(chaincount));
return 1;
}
int32 scriptlib::duel_is_chain_disablable(lua_State * L) {
Expand Down
2 changes: 1 addition & 1 deletion ocgcore/operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int32 field::negate_chain(uint8 chaincount) {
if(chaincount > core.current_chain.size() || chaincount < 1)
chaincount = core.current_chain.size();
chain& pchain = core.current_chain[chaincount - 1];
if(!(pchain.flag & CHAIN_DISABLE_ACTIVATE) && is_chain_inactivatable(pchain.chain_count)
if(!(pchain.flag & CHAIN_DISABLE_ACTIVATE) && is_chain_negatable(pchain.chain_count)
&& pchain.triggering_effect->handler->is_affect_by_effect(core.reason_effect) ) {
pchain.flag |= CHAIN_DISABLE_ACTIVATE | CHAIN_NEGATED;
pchain.disable_reason = core.reason_effect;
Expand Down
4 changes: 2 additions & 2 deletions ocgcore/processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3931,11 +3931,11 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
}
case 1: {
effect* peffect = cait->triggering_effect;
if(cait->flag & CHAIN_DISABLE_ACTIVATE && is_chain_inactivatable(cait->chain_count)) {
if(cait->flag & CHAIN_DISABLE_ACTIVATE && is_chain_negatable(cait->chain_count)) {
remove_oath_effect(peffect);
if((peffect->flag & EFFECT_FLAG_COUNT_LIMIT) && (peffect->flag & EFFECT_FLAG_REPEAT))
peffect->reset_count += 0x100;
raise_event((card*)0, EVENT_CHAIN_INACTIVATED, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count);
raise_event((card*)0, EVENT_CHAIN_NEGATED, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count);
process_instant_event();
core.units.begin()->step = 9;
return FALSE;
Expand Down
6 changes: 3 additions & 3 deletions ocgcore/scriptlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ class scriptlib {
static int32 card_is_attackable(lua_State *L);
static int32 card_is_chain_attackable(lua_State *L);
static int32 card_is_faceup(lua_State *L);
static int32 card_is_attack(lua_State *L);
static int32 card_is_attack_pos(lua_State *L);
static int32 card_is_facedown(lua_State *L);
static int32 card_is_defence(lua_State *L);
static int32 card_is_defence_pos(lua_State *L);
static int32 card_is_position(lua_State *L);
static int32 card_is_pre_position(lua_State *L);
static int32 card_is_controler(lua_State *L);
Expand Down Expand Up @@ -433,7 +433,7 @@ class scriptlib {
static int32 duel_is_player_can_send_to_hand(lua_State *L);
static int32 duel_is_player_can_send_to_grave(lua_State *L);
static int32 duel_is_player_can_send_to_deck(lua_State *L);
static int32 duel_is_chain_inactivatable(lua_State *L);
static int32 duel_is_chain_negatable(lua_State *L);
static int32 duel_is_chain_disablable(lua_State *L);
static int32 duel_check_chain_target(lua_State *L);
static int32 duel_check_chain_uniqueness(lua_State *L);
Expand Down
4 changes: 2 additions & 2 deletions script/c10591919.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function c10591919.filter(c,e,tp)
return c:IsSetCard(0x26) and c:GetLevel()==4 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c10591919.cona(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsDisabled() and e:GetHandler():IsAttack()
return not e:GetHandler():IsDisabled() and e:GetHandler():IsAttackPos()
end
function c10591919.tga(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
Expand All @@ -50,5 +50,5 @@ function c10591919.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
function c10591919.cond(e)
return e:GetHandler():IsDefence()
return e:GetHandler():IsDefencePos()
end
2 changes: 1 addition & 1 deletion script/c10651797.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function c10651797.initial_effect(c)
c:RegisterEffect(e1)
end
function c10651797.condition(e,tp,eg,ep,ev,re,r,rp)
return re:IsActiveType(TYPE_MONSTER) and re:GetCode()==EVENT_SPSUMMON_SUCCESS and Duel.IsChainInactivatable(ev)
return re:IsActiveType(TYPE_MONSTER) and re:GetCode()==EVENT_SPSUMMON_SUCCESS and Duel.IsChainNegatable(ev)
end
function c10651797.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Expand Down
2 changes: 1 addition & 1 deletion script/c11052544.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function c11052544.filter(c)
return c:IsFaceup() and c:IsDestructable()
end
function c11052544.cfilter(c)
return c:IsFaceup() and c:IsAttack() and c:IsSetCard(0x100d)
return c:IsFaceup() and c:IsAttackPos() and c:IsSetCard(0x100d)
end
function c11052544.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
Expand Down
2 changes: 1 addition & 1 deletion script/c11102908.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function c11102908.initial_effect(c)
--atk down
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_DAMAGE_CALCULATE)
e2:SetCode(EVENT_DAMAGE_CALCULATING)
e2:SetRange(LOCATION_SZONE)
e2:SetOperation(c11102908.atkup)
c:RegisterEffect(e2)
Expand Down
2 changes: 1 addition & 1 deletion script/c11819616.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function c11819616.discon(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return tg:IsExists(Card.IsOnField,1,nil) and Duel.IsChainInactivatable(ev)
return tg:IsExists(Card.IsOnField,1,nil) and Duel.IsChainNegatable(ev)
end
function c11819616.costfilter(c)
return c:IsFaceup() and c:IsRace(RACE_PLANT)
Expand Down
2 changes: 1 addition & 1 deletion script/c12298909.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function c12298909.filter(c)
return c:IsOnField() and c:IsType(TYPE_MONSTER)
end
function c12298909.condition(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsChainInactivatable(ev) then return false end
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsChainNegatable(ev) then return false end
local ex,tg,tc=Duel.GetOperationInfo(ev,CATEGORY_DESTROY)
return ex and tg~=nil and tc+tg:FilterCount(c12298909.filter,nil)-tg:GetCount()>0
end
Expand Down
2 changes: 1 addition & 1 deletion script/c1287123.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function c1287123.filter(c)
return c:IsOnField() and c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c1287123.condition(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsChainInactivatable(ev) then return false end
if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsChainNegatable(ev) then return false end
if not re:IsActiveType(TYPE_MONSTER) or re:IsHasCategory(CATEGORY_NEGATE) then return false end
local ex,tg,tc=Duel.GetOperationInfo(ev,CATEGORY_DESTROY)
return ex and tg~=nil and tc+tg:FilterCount(c1287123.filter,nil)-tg:GetCount()>0
Expand Down
1 change: 0 additions & 1 deletion script/c12940613.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ function c12940613.activate(e,tp,eg,ep,ev,re,r,rp)
end
local dg=Duel.GetMatchingGroup(c12940613.tdfilter,tp,LOCATION_GRAVE,0,nil)
if dg:GetCount()~=0 and Duel.SelectYesNo(tp,aux.Stringid(12940613,0)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
Duel.SendtoDeck(dg:Select(tp,1,1,nil),nil,2,REASON_EFFECT)
end
Expand Down
2 changes: 1 addition & 1 deletion script/c13108445.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function c13108445.poscon(e,tp,eg,ep,ev,re,r,rp)
end
function c13108445.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsAttack() then
if c:IsAttackPos() then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
2 changes: 1 addition & 1 deletion script/c13215230.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function c13215230.initial_effect(c)
end
function c13215230.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return bit.band(c:GetPreviousPosition(),POS_ATTACK)~=0 and c:IsFaceup() and c:IsDefence()
return bit.band(c:GetPreviousPosition(),POS_ATTACK)~=0 and c:IsFaceup() and c:IsDefencePos()
end
function c13215230.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsDestructable() end
Expand Down
2 changes: 1 addition & 1 deletion script/c1362589.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function c1362589.poscon(e,tp,eg,ep,ev,re,r,rp)
end
function c1362589.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsAttack() then
if c:IsAttackPos() then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
43 changes: 43 additions & 0 deletions script/c13722870.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--黒炎の騎士-ブラック·フレア·ナイト-
function c13722870.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCode2(c,46986414,45231177,true,true)
--Special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(13722870,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c13722870.spcon)
e1:SetTarget(c13722870.sptg)
e1:SetOperation(c13722870.spop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e2:SetValue(1)
c:RegisterEffect(e2)
end
c13722870.material_count=2
c13722870.material={46986414,45231177}
function c13722870.spfilter(c,e,tp)
return c:IsCode(49217579) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function c13722870.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE)
end
function c13722870.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c13722870.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,c13722870.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)
g:GetFirst():CompleteProcedure()
end
end
39 changes: 39 additions & 0 deletions script/c13803864.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--キング·もけもけ
function c13803864.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCodeRep(c,27288416,3,true,true)
--Special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(13803864,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetCondition(c13803864.spcon)
e1:SetTarget(c13803864.sptg)
e1:SetOperation(c13803864.spop)
c:RegisterEffect(e1)
end
c13803864.material_count=1
c13803864.material={27288416}
function c13803864.spfilter(c,e,tp)
return c:IsCode(27288416) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c13803864.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousPosition(POS_FACEUP) and not e:GetHandler():IsLocation(LOCATION_DECK)
end
function c13803864.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c13803864.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function c13803864.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c13803864.spfilter,tp,LOCATION_GRAVE,0,ft,ft,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
Loading

0 comments on commit 60b9769

Please sign in to comment.