repo_name stringlengths 6 69 | path stringlengths 6 178 | copies stringclasses 278
values | size stringlengths 4 7 | content stringlengths 671 917k | license stringclasses 15
values |
|---|---|---|---|---|---|
SalvationDevelopment/Salvation-Scripts-TCG | c30488793.lua | 6 | 1372 | --反発力
function c30488793.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetCode(EVENT_ATTACK_DISABLED)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCondition(c30488793.condition)
e1:SetTarget(c30488793.target)
e1:SetOperation(c30488793.activate)
c:RegisterEffect(e1)
end
function c30488793.condition(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local t=Duel.GetAttackTarget()
return a:IsLocation(LOCATION_MZONE) and t and t:IsLocation(LOCATION_MZONE) and t:IsPosition(POS_FACEUP_ATTACK)
end
function c30488793.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local a=Duel.GetAttacker()
local t=Duel.GetAttackTarget()
local g=Group.FromCards(a,t)
local dam=math.abs(a:GetAttack()-t:GetAttack())
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(dam)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,0,0,1-tp,dam)
end
function c30488793.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()<2 then return end
local c1=g:GetFirst()
local c2=g:GetNext()
if c1:IsFaceup() and c2:IsFaceup() then
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local dam=math.abs(c1:GetAttack()-c2:GetAttack())
Duel.Damage(p,dam,REASON_EFFECT)
end
end
| gpl-2.0 |
Turttle/darkstar | scripts/globals/mobskills/Necrobane.lua | 43 | 1075 | ---------------------------------------------
-- Necrobane
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
if(mob:getFamily() == 316) then
local mobSkin = mob:getModelId();
if (mobSkin == 1839) then
return 0;
else
return 1;
end
end
if(mob:getFamily() == 91) then
local mobSkin = mob:getModelId();
if (mobSkin == 1840) then
return 0;
else
return 1;
end
end
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
local numhits = 1;
local accmod = 1;
local dmgmod = 2;
local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_BLUNT,info.hitslanded);
target:delHP(dmg);
MobStatusEffectMove(mob, target, EFFECT_CURSE_I, 1, 0, 60);
return dmg;
end;
| gpl-3.0 |
dickeyf/darkstar | scripts/globals/mobskills/Necrobane.lua | 43 | 1075 | ---------------------------------------------
-- Necrobane
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
if(mob:getFamily() == 316) then
local mobSkin = mob:getModelId();
if (mobSkin == 1839) then
return 0;
else
return 1;
end
end
if(mob:getFamily() == 91) then
local mobSkin = mob:getModelId();
if (mobSkin == 1840) then
return 0;
else
return 1;
end
end
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
local numhits = 1;
local accmod = 1;
local dmgmod = 2;
local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_BLUNT,info.hitslanded);
target:delHP(dmg);
MobStatusEffectMove(mob, target, EFFECT_CURSE_I, 1, 0, 60);
return dmg;
end;
| gpl-3.0 |
Turttle/darkstar | scripts/zones/Norg/npcs/Parlemaille.lua | 34 | 1924 | -----------------------------------
-- Area: Norg
-- NPC: Parlemaille
-- Standard Info NPC
-----------------------------------
require("scripts/globals/pathfind");
local path = {
-20.369047, 1.097733, -24.847025,
-20.327482, 1.097733, -25.914215,
-20.272402, 1.097733, -27.108938,
-20.094927, 1.097733, -26.024536,
-19.804167, 1.097733, -13.467897,
-20.166626, 1.097733, -29.047626,
-20.415781, 1.097733, -30.099203,
-20.956963, 1.097733, -31.050713,
-21.629911, 1.097733, -31.904819,
-22.395691, 1.097733, -32.705379,
-23.187502, 1.097733, -33.450657,
-24.126440, 1.097733, -33.993565,
-25.146549, 1.097733, -34.370991,
-24.118807, 1.097733, -34.021263,
-23.177444, 1.097733, -33.390072,
-22.360268, 1.097733, -32.672077,
-21.594837, 1.097733, -31.877075,
-20.870659, 1.097733, -30.991661,
-20.384108, 1.097733, -29.968874,
-20.212332, 1.097733, -28.944513,
-20.144073, 1.097733, -27.822714,
-20.110937, 1.097733, -26.779232,
-19.802849, 1.097733, -13.406805
};
function onSpawn(npc)
npc:initNpcAi();
npc:setPos(pathfind.first(path));
-- onPath(npc);
end;
function onPath(npc)
pathfind.patrol(npc, path);
end;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x0058);
npc:wait(-1);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option,npc)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
npc:wait(0);
end;
| gpl-3.0 |
mrjon1/irkeeper | plugins/invite.lua | 63 | 1107 | do
local function callbackres(extra, success, result) -- Callback for res_user in line 27
local user = 'user#id'..result.id
local chat = 'chat#id'..extra.chatid
if is_banned(result.id, extra.chatid) or is_gbanned(result.id) then -- Ignore bans and globall bans
send_large_msg(chat, 'User is banned.')
else
chat_add_user(chat, user, ok_cb, false) -- Add user on chat
end
end
function run(msg, matches)
local data = load_data(_config.moderation.data)
if not is_realm(msg) then
if data[tostring(msg.to.id)]['settings']['lock_member'] == 'yes' and not is_admin(msg) then
return 'Group is private.'
end
end
if msg.to.type ~= 'chat' then
return
end
if not is_momod(msg) then
return
end
--if not is_admin(msg) then -- For admins only !
--return 'Only admins can invite.'
--end
local cbres_extra = {chatid = msg.to.id}
local username = matches[1]
local username = username:gsub("@","")
res_user(username, callbackres, cbres_extra)
end
return {
patterns = {
"^/invite (.*)$"
},
run = run
}
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c92223641.lua | 7 | 1431 | --天空の泉
function c92223641.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--adjust
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_RECOVER)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BATTLE_DESTROYED)
e2:SetRange(LOCATION_SZONE)
e2:SetCost(c92223641.cost)
e2:SetTarget(c92223641.tg)
e2:SetOperation(c92223641.op)
c:RegisterEffect(e2)
end
function c92223641.filter(g,tp)
local c=g:GetFirst()
if c:IsControler(1-tp) then c=g:GetNext() end
if c and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLocation(LOCATION_GRAVE) then return c end
return nil
end
function c92223641.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local rc=c92223641.filter(eg,tp)
return rc and rc:IsAbleToRemoveAsCost()
end
local rc=c92223641.filter(eg,tp)
e:SetLabel(rc:GetAttack())
Duel.Remove(rc,POS_FACEUP,REASON_EFFECT)
end
function c92223641.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(e:GetLabel())
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,e:GetLabel())
end
function c92223641.op(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
| gpl-2.0 |
Turttle/darkstar | scripts/zones/Mhaura/npcs/Vera.lua | 17 | 2861 | -----------------------------------
-- Area: Mhaura
-- NPC: Vera
-- Finishes Quest: The Old Lady
-- @pos -49 -5 20 249
-----------------------------------
package.loaded["scripts/zones/Mhaura/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
require("scripts/zones/Mhaura/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local questStatus = player:getQuestStatus(OTHER_AREAS,THE_OLD_LADY);
if (questStatus == QUEST_ACCEPTED and trade:getItemCount() == 1) then
local VeraOldLadyVar = player:getVar("VeraOldLadyVar");
if (VeraOldLadyVar == 1 and trade:hasItemQty(542,1)) then
player:startEvent(0x0087,541);
elseif (VeraOldLadyVar == 2 and trade:hasItemQty(541,1)) then
player:startEvent(0x0088,540);
elseif (VeraOldLadyVar == 3 and trade:hasItemQty(540,1)) then
player:startEvent(0x0089);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local questStatus = player:getQuestStatus(OTHER_AREAS, THE_OLD_LADY);
if (player:getQuestStatus(OTHER_AREAS, ELDER_MEMORIES) ~= QUEST_AVAILABLE) then
player:startEvent(0x0082);
elseif (questStatus == QUEST_COMPLETED) then
player:startEvent(0x008a);
elseif (questStatus == QUEST_ACCEPTED) then
VeraOldLadyVar = player:getVar("VeraOldLadyVar");
if (VeraOldLadyVar == 1) then
player:startEvent(0x0084,542);
elseif (VeraOldLadyVar == 2) then
player:startEvent(0x0084,541);
elseif (VeraOldLadyVar == 3) then
player:startEvent(0x0084,540);
end
else
if (player:getMainLvl() >= SUBJOB_QUEST_LEVEL) then
player:startEvent(0x0083,542);
else
player:startEvent(0x0085);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID2: %u",csid);
--printf("RESULT2: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x0083 and option == 40) then
player:addQuest(OTHER_AREAS, THE_OLD_LADY);
player:setVar("VeraOldLadyVar", 1);
elseif (csid == 0x0087) then
player:tradeComplete();
player:setVar("VeraOldLadyVar", 2);
elseif (csid == 0x0088) then
player:tradeComplete();
player:setVar("VeraOldLadyVar", 3);
elseif (csid == 0x0089) then
player:tradeComplete();
player:unlockJob(0);
player:setVar("VeraOldLadyVar", 0);
player:messageSpecial(SUBJOB_UNLOCKED);
player:completeQuest(OTHER_AREAS,THE_OLD_LADY);
end
end; | gpl-3.0 |
crazyboy11/premium | plugins/get.lua | 613 | 1067 | local function get_variables_hash(msg)
if msg.to.type == 'chat' then
return 'chat:'..msg.to.id..':variables'
end
if msg.to.type == 'user' then
return 'user:'..msg.from.id..':variables'
end
end
local function list_variables(msg)
local hash = get_variables_hash(msg)
if hash then
local names = redis:hkeys(hash)
local text = ''
for i=1, #names do
text = text..names[i]..'\n'
end
return text
end
end
local function get_value(msg, var_name)
local hash = get_variables_hash(msg)
if hash then
local value = redis:hget(hash, var_name)
if not value then
return'Not found, use "!get" to list variables'
else
return var_name..' => '..value
end
end
end
local function run(msg, matches)
if matches[2] then
return get_value(msg, matches[2])
else
return list_variables(msg)
end
end
return {
description = "Retrieves variables saved with !set",
usage = "!get (value_name): Returns the value_name value.",
patterns = {
"^(!get) (.+)$",
"^!get$"
},
run = run
}
| gpl-2.0 |
Death15/Mega-Tauch | plugins/get.lua | 613 | 1067 | local function get_variables_hash(msg)
if msg.to.type == 'chat' then
return 'chat:'..msg.to.id..':variables'
end
if msg.to.type == 'user' then
return 'user:'..msg.from.id..':variables'
end
end
local function list_variables(msg)
local hash = get_variables_hash(msg)
if hash then
local names = redis:hkeys(hash)
local text = ''
for i=1, #names do
text = text..names[i]..'\n'
end
return text
end
end
local function get_value(msg, var_name)
local hash = get_variables_hash(msg)
if hash then
local value = redis:hget(hash, var_name)
if not value then
return'Not found, use "!get" to list variables'
else
return var_name..' => '..value
end
end
end
local function run(msg, matches)
if matches[2] then
return get_value(msg, matches[2])
else
return list_variables(msg)
end
end
return {
description = "Retrieves variables saved with !set",
usage = "!get (value_name): Returns the value_name value.",
patterns = {
"^(!get) (.+)$",
"^!get$"
},
run = run
}
| gpl-2.0 |
sevenbot/teamseven | plugins/get.lua | 613 | 1067 | local function get_variables_hash(msg)
if msg.to.type == 'chat' then
return 'chat:'..msg.to.id..':variables'
end
if msg.to.type == 'user' then
return 'user:'..msg.from.id..':variables'
end
end
local function list_variables(msg)
local hash = get_variables_hash(msg)
if hash then
local names = redis:hkeys(hash)
local text = ''
for i=1, #names do
text = text..names[i]..'\n'
end
return text
end
end
local function get_value(msg, var_name)
local hash = get_variables_hash(msg)
if hash then
local value = redis:hget(hash, var_name)
if not value then
return'Not found, use "!get" to list variables'
else
return var_name..' => '..value
end
end
end
local function run(msg, matches)
if matches[2] then
return get_value(msg, matches[2])
else
return list_variables(msg)
end
end
return {
description = "Retrieves variables saved with !set",
usage = "!get (value_name): Returns the value_name value.",
patterns = {
"^(!get) (.+)$",
"^!get$"
},
run = run
}
| gpl-2.0 |
dickeyf/darkstar | scripts/zones/East_Ronfaure_[S]/npcs/Logging_Point.lua | 13 | 1077 | -----------------------------------
-- Area: East Ronfaure [S]
-- NPC: Logging Point
-----------------------------------
package.loaded["scripts/zones/East_Ronfaure_[S]/TextIDs"] = nil;
-------------------------------------
require("scripts/globals/logging");
require("scripts/zones/East_Ronfaure_[S]/TextIDs");
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
startLogging(player,player:getZoneID(),npc,trade,0x0385);
end;
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
player:messageSpecial(LOGGING_IS_POSSIBLE_HERE,1021);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c88120966.lua | 2 | 1784 | --No.15 ギミック・パペット-ジャイアントキラー
function c88120966.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,nil,8,2)
c:EnableReviveLimit()
--attack up
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e1:SetDescription(aux.Stringid(88120966,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(2)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c88120966.condition)
e1:SetCost(c88120966.cost)
e1:SetTarget(c88120966.target)
e1:SetOperation(c88120966.operation)
c:RegisterEffect(e1)
end
c88120966.xyz_number=15
function c88120966.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1
end
function c88120966.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 c88120966.filter(c)
return bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL
end
function c88120966.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 c88120966.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c88120966.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c88120966.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c88120966.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
if Duel.Destroy(tc,REASON_EFFECT)~=0 and tc:IsType(TYPE_XYZ) then
Duel.BreakEffect()
local atk=tc:GetBaseAttack()
if atk<0 then atk=0 end
Duel.Damage(1-tp,atk,REASON_EFFECT)
end
end
end
| gpl-2.0 |
RussellHaley/lua-http | spec/proxies_spec.lua | 3 | 2259 | describe("http.proxies module", function()
local http_proxies = require "http.proxies"
it("works", function()
local proxies = http_proxies.new():update(function(k) return ({
http_proxy = "http://http.proxy";
https_proxy = "http://https.proxy";
all_proxy = "http://all.proxy";
no_proxy = nil;
})[k] end)
assert.same({
http_proxy = "http://http.proxy";
https_proxy = "http://https.proxy";
all_proxy = "http://all.proxy";
no_proxy = nil;
}, proxies)
assert.same("http://http.proxy", proxies:choose("http", "myhost"))
assert.same("http://https.proxy", proxies:choose("https", "myhost"))
assert.same("http://all.proxy", proxies:choose("other", "myhost"))
end)
it("isn't vulnerable to httpoxy", function()
assert.same({}, http_proxies.new():update(function(k) return ({
GATEWAY_INTERFACE = "CGI/1.1";
http_proxy = "vulnerable to httpoxy";
})[k] end))
end)
it("works with no_proxy set to *", function()
local proxies = http_proxies.new():update(function(k) return ({
http_proxy = "http://http.proxy";
https_proxy = "http://https.proxy";
all_proxy = "http://all.proxy";
no_proxy = "*";
})[k] end)
-- Should return nil due to no_proxy being *
assert.same(nil, proxies:choose("http", "myhost"))
assert.same(nil, proxies:choose("https", "myhost"))
assert.same(nil, proxies:choose("other", "myhost"))
end)
it("works with a no_proxy set", function()
local proxies = http_proxies.new():update(function(k) return ({
http_proxy = "http://http.proxy";
no_proxy = "foo,bar.com,.extra.dot.com";
})[k] end)
assert.same("http://http.proxy", proxies:choose("http", "myhost"))
assert.is.table(proxies.no_proxy)
assert.same(nil, proxies:choose("http", "foo"))
assert.same(nil, proxies:choose("http", "bar.com"))
assert.same(nil, proxies:choose("http", "subdomain.bar.com"))
assert.same(nil, proxies:choose("http", "sub.sub.subdomain.bar.com"))
assert.same(nil, proxies:choose("http", "someting.foo"))
assert.same("http://http.proxy", proxies:choose("http", "else.com"))
assert.same(nil, proxies:choose("http", "more.extra.dot.com"))
assert.same(nil, proxies:choose("http", "extra.dot.com"))
assert.same("http://http.proxy", proxies:choose("http", "dot.com"))
end)
end)
| mit |
SalvationDevelopment/Salvation-Scripts-TCG | c81278754.lua | 2 | 1822 | --裏ガエル
function c81278754.initial_effect(c)
--turn set
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(81278754,0))
e1:SetCategory(CATEGORY_POSITION)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c81278754.target)
e1:SetOperation(c81278754.operation)
c:RegisterEffect(e1)
--damage
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(81278754,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_FLIP)
e2:SetTarget(c81278754.rettg)
e2:SetOperation(c81278754.retop)
c:RegisterEffect(e2)
end
function c81278754.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsCanTurnSet() and c:GetFlagEffect(81278754)==0 end
c:RegisterFlagEffect(81278754,RESET_EVENT+0x1fc0000+RESET_PHASE+PHASE_END,0,1)
Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0)
end
function c81278754.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE)
end
end
function c81278754.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x12)
end
function c81278754.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c81278754.cfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,0,LOCATION_MZONE,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,0)
end
function c81278754.retop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetMatchingGroupCount(c81278754.cfilter,tp,LOCATION_MZONE,0,nil)
if ct==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,0,LOCATION_MZONE,1,ct,nil)
Duel.SendtoHand(g,nil,REASON_EFFECT)
end
| gpl-2.0 |
dickeyf/darkstar | scripts/zones/Meriphataud_Mountains/npcs/Buliame_RK.lua | 13 | 3350 | -----------------------------------
-- Area: Meriphataud Mountains
-- NPC: Buliame, R.K.
-- Type: Border Conquest Guards
-- @pos -120.393 -25.822 -592.604 119
-----------------------------------
package.loaded["scripts/zones/Meriphataud_Mountains/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/Meriphataud_Mountains/TextIDs");
local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = ARAGONEU;
local csid = 0x7ffa;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
tradeConquestGuard(player,npc,trade,guardnation,guardtype);
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then
if (supplyRunFresh(player) == 1) then
player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies !
else
player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use."
player:delKeyItem(getSupplyKey(region));
player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region));
player:setVar("supplyQuest_region",0);
end
else
local arg1 = getArg1(guardnation, player) - 1;
if (arg1 >= 1792) then -- foreign, non-allied
player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0);
else -- citizen or allied
player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
if (option == 1) then
local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600;
player:delStatusEffect(EFFECT_SIGIL);
player:delStatusEffect(EFFECT_SANCTION);
player:delStatusEffect(EFFECT_SIGNET);
player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet
elseif (option == 2) then
player:delKeyItem(getSupplyKey(region));
player:addCP(supplyReward[region + 1])
player:messageSpecial(CONQUEST); -- "You've earned conquest points!"
if (hasOutpost(player, region+5) == 0) then
local supply_quests = 2^(region+5);
player:addNationTeleport(guardnation,supply_quests);
player:setVar("supplyQuest_region",0);
end
elseif (option == 4) then
if (player:delGil(giltosetHP(guardnation,player))) then
player:setHomePoint();
player:messageSpecial(CONQUEST + 94); -- "Your home point has been set."
else
player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here."
end
end
end; | gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c53180020.lua | 5 | 2483 | --影霊衣の戦士 エグザ
function c53180020.initial_effect(c)
--tohand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(53180020,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_RELEASE)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,53180020)
e1:SetCondition(c53180020.thcon)
e1:SetTarget(c53180020.thtg)
e1:SetOperation(c53180020.thop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(53180020,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_REMOVE)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,53180020)
e2:SetTarget(c53180020.sptg)
e2:SetOperation(c53180020.spop)
c:RegisterEffect(e2)
end
function c53180020.thcon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0
end
function c53180020.thfilter(c)
return c:IsSetCard(0xb4) and c:IsType(TYPE_RITUAL) and c:IsRace(RACE_DRAGON) and c:IsAbleToHand()
end
function c53180020.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c53180020.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c53180020.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c53180020.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c53180020.spfilter(c,e,tp)
return c:IsSetCard(0xb4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c53180020.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c53180020.spfilter(chkc,e,tp) and chkc~=e:GetHandler() end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c53180020.spfilter,tp,LOCATION_REMOVED,0,1,e:GetHandler(),e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c53180020.spfilter,tp,LOCATION_REMOVED,0,1,1,e:GetHandler(),e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c53180020.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
dickeyf/darkstar | scripts/zones/Lufaise_Meadows/npcs/Jemmoquel_RK.lua | 13 | 3331 | -----------------------------------
-- Area: Lufaise Meadows
-- NPC: Jemmoquel, R.K.
-- Outpost Conquest Guards
-- @pos -542.418 -7.124 -53.521 24
-----------------------------------
package.loaded["scripts/zones/Lufaise_Meadows/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/conquest");
require("scripts/zones/Lufaise_Meadows/TextIDs");
local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno
local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border
local region = TAVNAZIANARCH;
local csid = 0x7ffb;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
tradeConquestGuard(player,npc,trade,guardnation,guardtype);
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then
if (supplyRunFresh(player) == 1) then
player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies !
else
player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use."
player:delKeyItem(getSupplyKey(region));
player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region));
player:setVar("supplyQuest_region",0);
end
else
local arg1 = getArg1(guardnation, player) - 1;
if (arg1 >= 1792) then -- foreign, non-allied
player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0);
else -- citizen or allied
player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("OPTION: %u",option);
if (option == 1) then
local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600;
player:delStatusEffect(EFFECT_SIGIL);
player:delStatusEffect(EFFECT_SANCTION);
player:delStatusEffect(EFFECT_SIGNET);
player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet
elseif (option == 2) then
player:delKeyItem(getSupplyKey(region));
player:addCP(supplyReward[region + 1])
player:messageSpecial(CONQUEST); -- "You've earned conquest points!"
if (hasOutpost(player, region+5) == 0) then
local supply_quests = 2^(region+5);
player:addNationTeleport(guardnation,supply_quests);
player:setVar("supplyQuest_region",0);
end
elseif (option == 4) then
if (player:delGil(giltosetHP(guardnation,player))) then
player:setHomePoint();
player:messageSpecial(CONQUEST + 94); -- "Your home point has been set."
else
player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here."
end
end
end; | gpl-3.0 |
Turttle/darkstar | scripts/zones/Valkurm_Dunes/npcs/qm3.lua | 17 | 1900 | -----------------------------------
-- Area: Valkurm Dunes
-- NPC: qm3 (???)
-- Involved In Quest: Yomi Okuri
-- @pos -767 -4 192 103
-----------------------------------
package.loaded["scripts/zones/Valkurm_Dunes/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/zones/Valkurm_Dunes/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local cstime = VanadielHour();
if (player:hasKeyItem(YOMOTSU_HIRASAKA) and (cstime > 18 or cstime < 5) and GetMobAction(17199567) == 0 and GetMobAction(17199568) == 0) then
if (player:getVar("OkuriNMKilled") >= 1 and player:needToZone()) then
player:delKeyItem(YOMOTSU_HIRASAKA);
player:addKeyItem(FADED_YOMOTSU_HIRASAKA);
player:messageSpecial(KEYITEM_OBTAINED,FADED_YOMOTSU_HIRASAKA);
player:setVar("OkuriNMKilled",0);
else
player:startEvent(0x000a);
end
else
player:messageSpecial(NOTHING_OUT_OF_ORDINARY);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID2: %u",csid);
--printf("RESULT2: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x000a and option == 1) then
player:needToZone(true); -- If you zone, you will need to repeat the fight.
player:setVar("OkuriNMKilled",0);
SpawnMob(17199567,300):updateClaim(player); -- Doman
SpawnMob(17199568,300):updateClaim(player); -- Onryo
end
end; | gpl-3.0 |
Turttle/darkstar | scripts/zones/Aht_Urhgan_Whitegate/npcs/Shajaf.lua | 34 | 1031 | -----------------------------------
-- Area: Aht Urhgan Whitegate
-- NPC: Shajaf
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x00A2);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
Turttle/darkstar | scripts/zones/Mhaura/npcs/Graine.lua | 34 | 1595 | -----------------------------------
-- Area: Mhaura
-- NPC: Graine
-- Standard Merchant NPC
-----------------------------------
package.loaded["scripts/zones/Mhaura/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Mhaura/TextIDs");
require("scripts/globals/shop");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,GRAINE_SHOP_DIALOG);
stock = {0x3098,457, --Leather Bandana
0x30a0,174, --Bronze Cap
0x30a1,1700, --Brass Cap
0x3118,698, --Leather Vest
0x3120,235, --Bronze Harness
0x3121,2286, --Brass Harness
0x3198,374, --Leather Gloves
0x31a0,128, --Bronze Mittens
0x31a1,1255, --Brass Mittens
0x3218,557, --Leather Trousesrs
0x3220,191, --Bronze Subligar
0x3221,1840, --Brass Subligar
0x3298,349, --Leather Highboots
0x32a0,117, --Bronze Leggings
0x32a1,1140} --Brass Leggings
showShop(player, STATIC, stock);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
dickeyf/darkstar | scripts/globals/weaponskills/gust_slash.lua | 11 | 1259 | -----------------------------------
-- Gust Slash
-- Dagger weapon skill
-- Skill level: 40
-- Deals wind elemental damage. Damage varies with TP.
-- Will not stack with Sneak Attack.
-- Aligned with the Breeze Gorget.
-- Aligned with the Breeze Belt.
-- Element: Wind
-- Modifiers: DEX:20% ; INT:20%
-- 100%TP 200%TP 300%TP
-- 1.00 2.00 2.50
-----------------------------------
require("scripts/globals/magic");
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary)
local params = {};
params.ftp100 = 1; params.ftp200 = 2; params.ftp300 = 2.5;
params.str_wsc = 0.0; params.dex_wsc = 0.2; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.2; params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.ele = ELE_WIND;
params.skill = SKILL_DAG;
params.includemab = true;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.dex_wsc = 0.4; params.int_wsc = 0.4;
end
local damage, criticalHit, tpHits, extraHits = doMagicWeaponskill(player, target, wsID, params, tp, primary);
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c9744376.lua | 7 | 1097 | --ゴブリンのやりくり上手
function c9744376.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c9744376.target)
e1:SetOperation(c9744376.activate)
c:RegisterEffect(e1)
end
function c9744376.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
local ct=Duel.GetMatchingGroupCount(Card.IsCode,tp,LOCATION_GRAVE,0,nil,9744376)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct+1)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND)
end
function c9744376.activate(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local d=Duel.GetMatchingGroupCount(Card.IsCode,p,LOCATION_GRAVE,0,nil,9744376)+1
Duel.Draw(p,d,REASON_EFFECT)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(p,aux.TRUE,p,LOCATION_HAND,0,1,1,nil)
Duel.SendtoDeck(g,nil,1,REASON_EFFECT)
end
| gpl-2.0 |
eugeneia/snabb | lib/ljsyscall/syscall/bsd/types.lua | 24 | 9241 | -- BSD shared types
local require, error, assert, tonumber, tostring,
setmetatable, pairs, ipairs, unpack, rawget, rawset,
pcall, type, table, string =
require, error, assert, tonumber, tostring,
setmetatable, pairs, ipairs, unpack, rawget, rawset,
pcall, type, table, string
local function init(c, types)
local abi = require "syscall.abi"
local t, pt, s, ctypes = types.t, types.pt, types.s, types.ctypes
local ffi = require "ffi"
local bit = require "syscall.bit"
local h = require "syscall.helpers"
local addtype, addtype_var, addtype_fn, addraw2 = h.addtype, h.addtype_var, h.addtype_fn, h.addraw2
local ptt, reviter, mktype, istype, lenfn, lenmt, getfd, newfn
= h.ptt, h.reviter, h.mktype, h.istype, h.lenfn, h.lenmt, h.getfd, h.newfn
local ntohl, ntohl, ntohs, htons = h.ntohl, h.ntohl, h.ntohs, h.htons
local mt = {} -- metatables
local addtypes = {
}
local addstructs = {
}
for k, v in pairs(addtypes) do addtype(types, k, v) end
for k, v in pairs(addstructs) do addtype(types, k, v, lenmt) end
mt.sockaddr = {
index = {
len = function(sa) return sa.sa_len end,
family = function(sa) return sa.sa_family end,
},
newindex = {
len = function(sa, v) sa.sa_len = v end,
},
}
addtype(types, "sockaddr", "struct sockaddr", mt.sockaddr)
-- cast socket address to actual type based on family, defined later
local samap_pt = {}
mt.sockaddr_storage = {
index = {
len = function(sa) return sa.ss_len end,
family = function(sa) return sa.ss_family end,
},
newindex = {
len = function(sa, v) sa.ss_len = v end,
family = function(sa, v) sa.ss_family = c.AF[v] end,
},
__index = function(sa, k)
if mt.sockaddr_storage.index[k] then return mt.sockaddr_storage.index[k](sa) end
local st = samap_pt[sa.ss_family]
if st then
local cs = st(sa)
return cs[k]
end
error("invalid index " .. k)
end,
__newindex = function(sa, k, v)
if mt.sockaddr_storage.newindex[k] then
mt.sockaddr_storage.newindex[k](sa, v)
return
end
local st = samap_pt[sa.ss_family]
if st then
local cs = st(sa)
cs[k] = v
return
end
error("invalid index " .. k)
end,
__new = function(tp, init)
local ss = ffi.new(tp)
local family
if init and init.family then family = c.AF[init.family] end
local st
if family then
st = samap_pt[family]
ss.ss_family = family
init.family = nil
end
if st then
local cs = st(ss)
for k, v in pairs(init) do
cs[k] = v
end
end
ss.len = #ss
return ss
end,
-- netbsd likes to see the correct size when it gets a sockaddr; Linux was ok with a longer one
__len = function(sa)
if samap_pt[sa.family] then
local cs = samap_pt[sa.family](sa)
return #cs
else
return s.sockaddr_storage
end
end,
}
-- experiment, see if we can use this as generic type, to avoid allocations.
addtype(types, "sockaddr_storage", "struct sockaddr_storage", mt.sockaddr_storage)
mt.sockaddr_in = {
index = {
len = function(sa) return sa.sin_len end,
family = function(sa) return sa.sin_family end,
port = function(sa) return ntohs(sa.sin_port) end,
addr = function(sa) return sa.sin_addr end,
},
newindex = {
len = function(sa, v) sa.sin_len = v end,
family = function(sa, v) sa.sin_family = v end,
port = function(sa, v) sa.sin_port = htons(v) end,
addr = function(sa, v) sa.sin_addr = mktype(t.in_addr, v) end,
},
__new = function(tp, port, addr)
if type(port) == "table" then
port.len = s.sockaddr_in
return newfn(tp, port)
end
return newfn(tp, {len = s.sockaddr_in, family = c.AF.INET, port = port, addr = addr})
end,
__len = function(tp) return s.sockaddr_in end,
}
addtype(types, "sockaddr_in", "struct sockaddr_in", mt.sockaddr_in)
mt.sockaddr_in6 = {
index = {
len = function(sa) return sa.sin6_len end,
family = function(sa) return sa.sin6_family end,
port = function(sa) return ntohs(sa.sin6_port) end,
addr = function(sa) return sa.sin6_addr end,
},
newindex = {
len = function(sa, v) sa.sin6_len = v end,
family = function(sa, v) sa.sin6_family = v end,
port = function(sa, v) sa.sin6_port = htons(v) end,
addr = function(sa, v) sa.sin6_addr = mktype(t.in6_addr, v) end,
flowinfo = function(sa, v) sa.sin6_flowinfo = v end,
scope_id = function(sa, v) sa.sin6_scope_id = v end,
},
__new = function(tp, port, addr, flowinfo, scope_id) -- reordered initialisers.
if type(port) == "table" then
port.len = s.sockaddr_in6
return newfn(tp, port)
end
return newfn(tp, {len = s.sockaddr_in6, family = c.AF.INET6, port = port, addr = addr, flowinfo = flowinfo, scope_id = scope_id})
end,
__len = function(tp) return s.sockaddr_in6 end,
}
addtype(types, "sockaddr_in6", "struct sockaddr_in6", mt.sockaddr_in6)
mt.sockaddr_un = {
index = {
family = function(sa) return sa.sun_family end,
path = function(sa) return ffi.string(sa.sun_path) end,
},
newindex = {
family = function(sa, v) sa.sun_family = v end,
path = function(sa, v) ffi.copy(sa.sun_path, v) end,
},
__new = function(tp, path) return newfn(tp, {family = c.AF.UNIX, path = path, sun_len = s.sockaddr_un}) end,
__len = function(sa) return 2 + #sa.path end,
}
addtype(types, "sockaddr_un", "struct sockaddr_un", mt.sockaddr_un)
function t.sa(addr, addrlen) return addr end -- non Linux is trivial, Linux has odd unix handling
-- TODO need to check in detail all this as ported from Linux and may differ
mt.termios = {
makeraw = function(termios)
termios.c_iflag = bit.band(termios.iflag, bit.bnot(c.IFLAG["IGNBRK,BRKINT,PARMRK,ISTRIP,INLCR,IGNCR,ICRNL,IXON"]))
termios.c_oflag = bit.band(termios.oflag, bit.bnot(c.OFLAG["OPOST"]))
termios.c_lflag = bit.band(termios.lflag, bit.bnot(c.LFLAG["ECHO,ECHONL,ICANON,ISIG,IEXTEN"]))
termios.c_cflag = bit.bor(bit.band(termios.cflag, bit.bnot(c.CFLAG["CSIZE,PARENB"])), c.CFLAG.CS8)
termios.c_cc[c.CC.VMIN] = 1
termios.c_cc[c.CC.VTIME] = 0
return true
end,
index = {
iflag = function(termios) return tonumber(termios.c_iflag) end,
oflag = function(termios) return tonumber(termios.c_oflag) end,
cflag = function(termios) return tonumber(termios.c_cflag) end,
lflag = function(termios) return tonumber(termios.c_lflag) end,
makeraw = function(termios) return mt.termios.makeraw end,
ispeed = function(termios) return termios.c_ispeed end,
ospeed = function(termios) return termios.c_ospeed end,
},
newindex = {
iflag = function(termios, v) termios.c_iflag = c.IFLAG(v) end,
oflag = function(termios, v) termios.c_oflag = c.OFLAG(v) end,
cflag = function(termios, v) termios.c_cflag = c.CFLAG(v) end,
lflag = function(termios, v) termios.c_lflag = c.LFLAG(v) end,
ispeed = function(termios, v) termios.c_ispeed = v end,
ospeed = function(termios, v) termios.c_ospeed = v end,
speed = function(termios, v)
termios.c_ispeed = v
termios.c_ospeed = v
end,
},
}
for k, i in pairs(c.CC) do
mt.termios.index[k] = function(termios) return termios.c_cc[i] end
mt.termios.newindex[k] = function(termios, v) termios.c_cc[i] = v end
end
addtype(types, "termios", "struct termios", mt.termios)
mt.kevent = {
index = {
size = function(kev) return tonumber(kev.data) end,
fd = function(kev) return tonumber(kev.ident) end,
signal = function(kev) return tonumber(kev.ident) end,
},
newindex = {
fd = function(kev, v) kev.ident = t.uintptr(getfd(v)) end,
signal = function(kev, v) kev.ident = c.SIG[v] end,
-- due to naming, use 'set' names TODO better naming scheme reads oddly as not a function
setflags = function(kev, v) kev.flags = c.EV[v] end,
setfilter = function(kev, v) kev.filter = c.EVFILT[v] end,
},
__new = function(tp, tab)
if type(tab) == "table" then
tab.flags = c.EV[tab.flags]
tab.filter = c.EVFILT[tab.filter] -- TODO this should also support extra ones via ioctl see man page
tab.fflags = c.NOTE[tab.fflags]
end
local obj = ffi.new(tp)
for k, v in pairs(tab or {}) do obj[k] = v end
return obj
end,
}
for k, v in pairs(c.NOTE) do
mt.kevent.index[k] = function(kev) return bit.band(kev.fflags, v) ~= 0 end
end
for _, k in pairs{"FLAG1", "EOF", "ERROR"} do
mt.kevent.index[k] = function(kev) return bit.band(kev.flags, c.EV[k]) ~= 0 end
end
addtype(types, "kevent", "struct kevent", mt.kevent)
mt.kevents = {
__len = function(kk) return kk.count end,
__new = function(tp, ks)
if type(ks) == 'number' then return ffi.new(tp, ks, ks) end
local count = #ks
local kks = ffi.new(tp, count, count)
for n = 1, count do -- TODO ideally we use ipairs on both arrays/tables
local v = mktype(t.kevent, ks[n])
kks.kev[n - 1] = v
end
return kks
end,
__ipairs = function(kk) return reviter, kk.kev, kk.count end
}
addtype_var(types, "kevents", "struct {int count; struct kevent kev[?];}", mt.kevents)
-- this is declared above
samap_pt = {
[c.AF.UNIX] = pt.sockaddr_un,
[c.AF.INET] = pt.sockaddr_in,
[c.AF.INET6] = pt.sockaddr_in6,
}
return types
end
return {init = init}
| apache-2.0 |
Turttle/darkstar | scripts/zones/Port_Bastok/npcs/Ferrol.lua | 19 | 2970 | -----------------------------------
-- Area: Port Bastok
-- NPC: Ferrol
-- Starts Quest: Trial Size Trial by Earth
-- @pos 33.708 6.499 -39.425 236
-----------------------------------
package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/quests");
require("scripts/globals/teleports");
require("scripts/zones/Port_Bastok/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (trade:hasItemQty(1547,1) and player:getQuestStatus(BASTOK,TRIAL_SIZE_TRIAL_BY_EARTH) == QUEST_ACCEPTED and player:getMainJob() == JOB_SMN) then
player:startEvent(0x012a,0,1547,1,20);
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local TrialSizeEarth = player:getQuestStatus(BASTOK,TRIAL_SIZE_TRIAL_BY_EARTH);
if (player:getMainLvl() >= 20 and player:getMainJob() == JOB_SMN and TrialSizeEarth == QUEST_AVAILABLE and player:getFameLevel(BASTOK) >= 2) then -- Requires player to be Summoner at least lvl 20
player:startEvent(0x0129,0,1547,1,20); --mini tuning fork, zone, level
elseif (TrialSizeEarth == QUEST_ACCEPTED) then
local EarthFork = player:hasItem(1547);
if (EarthFork) then
player:startEvent(0x00fb); -- Dialogue given to remind player to be prepared
elseif (EarthFork == false and tonumber(os.date("%j")) ~= player:getVar("TrialSizeEarth_date")) then
player:startEvent(0x012d,0,1547,1,20); -- Need another mini tuning fork
else
player:startEvent(0x012f); -- Standard dialog when you loose, and you don't wait 1 real day
end
elseif (TrialSizeEarth == QUEST_COMPLETED) then
player:startEvent(0x012c); -- Defeated Avatar
else
player:startEvent(0x00fe); -- Standard dialog
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x0129 and option == 1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,1547); --Mini tuning fork
else
player:setVar("TrialSizeEarth_date",0)
player:addQuest(BASTOK,TRIAL_SIZE_TRIAL_BY_EARTH);
player:addItem(1547);
player:messageSpecial(ITEM_OBTAINED,1547);
end
elseif (csid == 0x012d and option == 1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,1547); --Mini tuning fork
else
player:addItem(1547);
player:messageSpecial(ITEM_OBTAINED,1547);
end
elseif (csid == 0x012a and option == 1) then
toCloisterOfTremors(player);
end
end; | gpl-3.0 |
Turttle/darkstar | scripts/globals/items/kusamochi+1.lua | 35 | 2086 | -----------------------------------------
-- ID: 6263
-- Item: kusamochi+1
-- Food Effect: 60 Min, All Races
-----------------------------------------
-- HP + 30 (Pet & Master)
-- Vitality + 4 (Pet & Master)
-- Attack + 21% Cap: 77 (Pet & Master) Pet Cap: 120
-- Ranged Attack + 21% Cap: 77 (Pet & Master) Pet Cap: 120
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD)) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,3600,6263);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 30)
target:addMod(MOD_VIT, 4)
target:addMod(MOD_FOOD_ATTP, 21)
target:addMod(MOD_FOOD_ATT_CAP, 77)
target:addMod(MOD_FOOD_RATTP, 16)
target:addMod(MOD_FOOD_RATT_CAP, 77)
target:addPetMod(MOD_HP, 30)
target:addPetMod(MOD_VIT, 4)
target:addPetMod(MOD_FOOD_ATTP, 21)
target:addPetMod(MOD_FOOD_ATT_CAP, 120)
target:addPetMod(MOD_FOOD_RATTP, 21)
target:addPetMod(MOD_FOOD_RATT_CAP, 120)
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_HP, 30)
target:delMod(MOD_VIT, 4)
target:delMod(MOD_FOOD_ATTP, 21)
target:delMod(MOD_FOOD_ATT_CAP, 77)
target:delMod(MOD_FOOD_RATTP, 16)
target:delMod(MOD_FOOD_RATT_CAP, 77)
target:delPetMod(MOD_HP, 30)
target:delPetMod(MOD_VIT, 4)
target:delPetMod(MOD_FOOD_ATTP, 21)
target:delPetMod(MOD_FOOD_ATT_CAP, 120)
target:delPetMod(MOD_FOOD_RATTP, 21)
target:delPetMod(MOD_FOOD_RATT_CAP, 120)
end;
| gpl-3.0 |
dickeyf/darkstar | scripts/zones/Quicksand_Caves/mobs/Princeps_IV-XLV.lua | 7 | 1340 | -----------------------------------
-- Area: Quicksand Caves
-- MOB: Princeps IV-XLV
-- Pops in Bastok mission 8-1 "The Chains that Bind Us"
-----------------------------------
package.loaded["scripts/zones/Quicksand_Caves/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Quicksand_Caves/TextIDs");
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobDisengage Action
-----------------------------------
function onMobDisengage(mob)
local self = mob:getID();
DespawnMob(self, 120);
end;
-----------------------------------
-- onMobDeath Action
-----------------------------------
function onMobDeath(mob,killer,ally)
if (ally:getCurrentMission(BASTOK) == THE_CHAINS_THAT_BIND_US and ally:getVar("MissionStatus") == 1) then
SetServerVariable("Bastok8-1LastClear", os.time());
end
end;
-----------------------------------
-- onMobDespawn Action
-----------------------------------
function onMobDespawn(mob)
local mobsup = GetServerVariable("BastokFight8_1");
SetServerVariable("BastokFight8_1",mobsup - 1);
if (GetServerVariable("BastokFight8_1") == 0) then
local npc = GetNPCByID(17629734); -- qm6
npc:setStatus(0); -- Reappear
end
end; | gpl-3.0 |
dickeyf/darkstar | scripts/globals/spells/curaga_v.lua | 28 | 1293 | -----------------------------------------
-- Spell: Curaga V
-- Restores HP of all party members within area of effect.
-----------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
local minCure = 600;
local divisor = 1;
local constant = 570;
local power = getCurePowerOld(caster);
if (power > 780) then
divisor = 2.667;
constant = 814;--this is too powerful and needs to be fixed when the rest of the curaga 5 numbers are determined
end
local final = getCureFinal(caster,spell,getBaseCureOld(power,divisor,constant),minCure,false);
final = final + (final * (target:getMod(MOD_CURE_POTENCY_RCVD)/100));
--Applying server mods....
final = final * CURE_POWER;
local diff = (target:getMaxHP() - target:getHP());
if (final > diff) then
final = diff;
end
target:restoreHP(final);
target:wakeUp();
caster:updateEnmityFromCure(target,final);
spell:setMsg(367);
return final;
end; | gpl-3.0 |
Turttle/darkstar | scripts/zones/Windurst_Waters_[S]/npcs/Pelftrix.lua | 34 | 1248 | -----------------------------------
-- Area: Windurst Waters (S)
-- NPC: Pelftrix
-- Standard Merchant NPC
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/zones/Windurst_Waters_[S]/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:showText(npc,PELFTRIX_SHOP_DIALOG);
stock = {0x1014,4500, -- Hi-Potion
0x1024,28000, -- Hi-Ether
0x03FC,300, -- Sickle
0x03FD,500} -- Hatchet
showShop(player, STATIC, stock);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
| gpl-3.0 |
eugeneia/snabb | src/lib/lpm/ip6.lua | 9 | 3597 | module(..., package.seeall)
local ffi = require("ffi")
local C = ffi.C
local lib = require("core.lib")
local htons = lib.htons
local ntohs = lib.ntohs
IP6 = {}
ip6_t = ffi.typeof([[
union {
uint64_t u64[2];
uint16_t u16[8];
uint8_t u8[16];
}
]])
local function colons (str)
local i = 0
for _ in string.gmatch(str, ":") do i = i + 1 end
return i
end
function IP6.parse (str)
local ipbytes = ffi.new(ip6_t)
assert(string.find(str, ":::") == nil)
local replace = string.rep(":0", 8 - colons(str)) .. ":"
str = string.gsub(str, ":$", ":0")
str = string.gsub(str, "^:", "0:")
str = string.gsub(str, "::", replace)
local blk = "(%x?%x?%x?%x?)"
local chunks = {
str:match("^" .. string.rep(blk .. ":", 7) .. blk .. "$")
}
assert(chunks[1] ~= nil, "Invalid IPv6 Address: " .. str)
for i,v in pairs(chunks) do
local n = tonumber(v, 16)
assert(n >= 0 and n < 2^16, "Invalid IPv6 Address: " .. str)
ipbytes.u16[i-1] = htons(n)
end
return ipbytes
end
function IP6.tostring (ip)
local tab = {}
for i = 1,8 do
tab[i] = string.format("%x", ntohs(ip.u16[i-1]))
end
local str = table.concat(tab, ":")
for i = 7,1,-1 do
local r = string.rep("0:", i) .. "0"
local s
s = string.gsub(str, "^" .. r, "::")
if s ~= str then return s end
s = string.gsub(str, ":" .. r .. "$", "::")
if s ~= str then return s end
end
return str
end
function IP6.eq (ipa, ipb)
return ipa.u64[0] == ipb.u64[0] and ipa.u64[1] == ipb.u64[1]
end
function IP6.get_bit (ip, offset)
assert(offset > 0)
assert(offset < 129)
local bits = bit.rshift(offset-1, 3)
return bit.band(bit.rshift(ip.u8[bits], 7-bit.band(offset-1, 7)), 1)
end
ffi.metatype(ip6_t, {
__index = IP6,
__tostring = IP6.tostring,
__eq = IP6.eq
})
function selftest ()
local ip
assert(colons("::") == 2)
assert(colons(":0:") == 2)
assert(colons("0:0:0") == 2)
-- Ensure tostring() works as a function
assert(IP6.tostring(IP6.parse("::")) == "::")
assert(IP6.tostring(IP6.parse("0::")) == "::")
assert(IP6.tostring(IP6.parse("0::0")) == "::")
assert(pcall(IP6.parse, "") == false)
assert(pcall(IP6.parse, "abg::") == false)
assert(pcall(IP6.parse, "12345::") == false)
assert(pcall(IP6.parse, "1245:::") == false)
assert(pcall(IP6.parse, "1:2:3:4:5:6:7:8:9") == false)
assert(pcall(IP6.parse, "1:2:3:4:5:6:7") == false)
-- Ensure tostring() works as a method
assert((IP6.parse("0::0")):tostring() == "::")
-- Ensure tostring() works
assert(tostring(IP6.parse("::")) == "::")
assert(IP6.parse("::") == IP6.parse("::"))
assert(IP6.parse("::1:2:3:4:5").u16[0] == 0)
assert(IP6.parse("::1:2:3:4:5").u16[1] == 0)
assert(IP6.parse("::1:2:3:4:5").u16[2] == 0)
assert(IP6.parse("::1:2:3:4:5").u16[3] == htons(1))
assert(IP6.parse("::1:2:3:4:5").u16[4] == htons(2))
assert(IP6.parse("::1:2:3:4:5").u16[5] == htons(3))
assert(IP6.parse("::1:2:3:4:5").u16[6] == htons(4))
assert(IP6.parse("::1:2:3:4:5").u16[7] == htons(5))
assert(IP6.parse("ffee::"):tostring() == "ffee::")
assert((IP6.parse("::1")):get_bit(128) == 1)
assert((IP6.parse("::1")):get_bit(127) == 0)
assert((IP6.parse("8001::1")):get_bit(1) == 1)
assert((IP6.parse("8000::1")):get_bit(2) == 0)
assert((IP6.parse("8000::1")):get_bit(2) == 0)
assert((IP6.parse("8001::1")):get_bit(15) == 0)
assert((IP6.parse("8001::1")):get_bit(16) == 1)
assert((IP6.parse("70::"):tostring() == "70::"))
assert((IP6.parse("070::"):tostring() == "70::"))
end
| apache-2.0 |
Turttle/darkstar | scripts/globals/mobskills/Miasma.lua | 25 | 1143 | ---------------------------------------------
-- Miasma
--
-- Description: Releases a toxic cloud on nearby targets. Additional effects: Slow + Poison + Plague
-- Type: Magical
-- Utsusemi/Blink absorb: Wipes shadows?
-- Range: Less than or equal to 10.0
-- Notes: Only used by Gulool Ja Ja.
---------------------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/monstertpmoves");
---------------------------------------------
function onMobSkillCheck(target,mob,skill)
return 0;
end;
function onMobWeaponSkill(target, mob, skill)
local duration = 180;
MobStatusEffectMove(mob, target, EFFECT_POISON, mob:getMainLvl()/3, 3, 60);
MobStatusEffectMove(mob, target, EFFECT_SLOW, 128, 3, 120);
MobStatusEffectMove(mob, target, EFFECT_PLAGUE, 5, 3, 60);
local dmgmod = 1;
local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*4,ELE_EARTH,dmgmod,TP_NO_EFFECT);
local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_EARTH,MOBPARAM_WIPE_SHADOWS);
target:delHP(dmg);
return dmg;
end;
| gpl-3.0 |
Turttle/darkstar | scripts/globals/weaponskills/shattersoul.lua | 30 | 2341 | -----------------------------------
-- Skill Level: 357
-- Description: Delivers a threefold attack. Decreases target's magic defense. Duration of effect varies with TP.
-- To obtain Shattersoul, the quest Martial Mastery must be completed and it must be purchased from the Merit Points menu.
-- Target's magic defense is lowered by 10.
-- Aligned with the Shadow Gorget, Soil Gorget & Snow Gorget.
-- Aligned with the Shadow Belt, Soil Belt & Snow Belt.
-- Element: N/A
-- Skillchain Properties: Gravitation/Induration
-- Shattersoul is only available to Warriors, Monks, White Mages, Black Mages, Paladins, Bards, Dragoons, Summoners and Scholars.
-- While some jobs may obtain skill level 357 earlier than level 96, Shattersoul must be unlocked once skill reaches level 357 and job level 96 is reached.
-- Staff skill level 357 is obtainable by the following jobs at these corresponding levels:
-- Modifiers: INT:73~85%, depending on merit points upgrades.
-- Damage Multipliers by TP:
-- 100%TP 200%TP 300%TP
-- 1.375 1.375 1.375
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID)
local params = {};
params.numHits = 3;
params.ftp100 = 1.375; params.ftp200 = 1.375; params.ftp300 = 1.375;
params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.85 + (player:getMerit(MERIT_SHATTERSOUL) / 100); params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0;
params.canCrit = false;
params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0;
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1;
params.int_wsc = 0.7 + (player:getMerit(MERIT_SHATTERSOUL) / 100);
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params);
if damage > 0 and (target:hasStatusEffect(EFFECT_MAGIC_DEF_DOWN) == false) then
target:addStatusEffect(EFFECT_MAGIC_DEF_DOWN, 10, 0, 120);
end
damage = damage * WEAPON_SKILL_POWER
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c70828912.lua | 5 | 2219 | --早すぎた埋葬
function c70828912.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCost(c70828912.cost)
e1:SetTarget(c70828912.target)
e1:SetOperation(c70828912.operation)
c:RegisterEffect(e1)
--Destroy
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetOperation(c70828912.desop)
c:RegisterEffect(e2)
end
function c70828912.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,800)
else Duel.PayLPCost(tp,800) end
end
function c70828912.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c70828912.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c70828912.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c70828912.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c70828912.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c70828912.eqlimit(e,c)
return e:GetLabelObject()==c
end
function c70828912.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK)==0 then return end
Duel.Equip(tp,c,tc)
--Add Equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c70828912.eqlimit)
e1:SetLabelObject(tc)
c:RegisterEffect(e1)
end
end
function c70828912.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=c:GetFirstCardTarget()
if c:IsReason(REASON_DESTROY) and tc and tc:IsLocation(LOCATION_MZONE) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c68226653.lua | 9 | 2304 | --フレムベル・ドラグノフ
function c68226653.initial_effect(c)
--damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(68226653,0))
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c68226653.damcon)
e1:SetTarget(c68226653.damtg)
e1:SetOperation(c68226653.damop)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(68226653,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(c68226653.thcost)
e2:SetTarget(c68226653.thtg)
e2:SetOperation(c68226653.thop)
c:RegisterEffect(e2)
end
function c68226653.damcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE)
and e:GetHandler():IsReason(REASON_BATTLE)
end
function c68226653.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(500)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500)
end
function c68226653.damop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
function c68226653.cfilter(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsAbleToRemoveAsCost()
end
function c68226653.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost()
and Duel.IsExistingMatchingCard(c68226653.cfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c68226653.cfilter,tp,LOCATION_MZONE,0,1,1,nil)
g:AddCard(e:GetHandler())
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c68226653.filter(c)
return c:IsCode(68226653) and c:IsAbleToHand()
end
function c68226653.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c68226653.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c68226653.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstMatchingCard(c68226653.filter,tp,LOCATION_DECK,0,nil)
if tc then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c17183908.lua | 4 | 1517 | --竜星の輝跡
function c17183908.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,17183908+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c17183908.target)
e1:SetOperation(c17183908.operation)
c:RegisterEffect(e1)
end
function c17183908.filter(c)
return c:IsSetCard(0x9e) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck()
end
function c17183908.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c17183908.filter(chkc) end
if chk==0 then return Duel.IsPlayerCanDraw(tp,2)
and Duel.IsExistingTarget(c17183908.filter,tp,LOCATION_GRAVE,0,3,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c17183908.filter,tp,LOCATION_GRAVE,0,3,3,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,3,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
function c17183908.operation(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)~=3 then return end
Duel.SendtoDeck(tg,nil,0,REASON_EFFECT)
local g=Duel.GetOperatedGroup()
if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)
if ct==3 then
Duel.BreakEffect()
Duel.Draw(tp,2,REASON_EFFECT)
end
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c54762426.lua | 9 | 1085 | --埋蔵金の地図
function c54762426.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c54762426.condition)
e1:SetTarget(c54762426.target)
e1:SetOperation(c54762426.activate)
c:RegisterEffect(e1)
end
function c54762426.condition(e,tp,eg,ep,ev,re,r,rp)
local ex,tg,tc=Duel.GetOperationInfo(ev,CATEGORY_TOHAND)
return ex and tg~=nil and tg:IsContains(e:GetHandler())
end
function c54762426.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1)
end
function c54762426.activate(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
if Duel.Draw(p,d,REASON_EFFECT)==2 then
Duel.BreakEffect()
Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT+REASON_DISCARD)
end
end
| gpl-2.0 |
Turttle/darkstar | scripts/globals/abilities/angon.lua | 13 | 1296 | -----------------------------------
-- Ability: Angon
-- Expends an Angon to lower an enemy's defense.
-- Obtained: Dragoon Level 75
-- Recast Time: 0:03:00
-- Duration: 0:00:30 (+0:00:15 for each merit, cap is 0:01:30)
-- Effect: Physical defense of target approximately -20% (51/256).
-- Range: 10.0 yalms
-- Notes: Only fails if it can't apply the def down status.
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
-----------------------------------
-- onAbilityCheck
-----------------------------------
function onAbilityCheck(player,target,ability)
local id = player:getEquipID(SLOT_AMMO);
if (id == 18259) then
return 0,0;
else
return MSGBASIC_UNABLE_TO_USE_JA,0;
end
end;
-----------------------------------
-- onUseAbility
-----------------------------------
function onUseAbility(player,target,ability)
local typeEffect = EFFECT_DEFENSE_DOWN;
local duration = 15 + player:getMerit(MERIT_ANGON); -- This will return 30 sec at one investment because merit power is 15.
if (target:addStatusEffect(typeEffect,20,0,duration) == false) then
ability:setMsg(75);
end
target:updateClaim(player);
return typeEffect;
end; | gpl-3.0 |
Turttle/darkstar | scripts/zones/Dynamis-Xarcabard/mobs/Animated_Tachi.lua | 16 | 1477 | -----------------------------------
-- Area: Dynamis Xarcabard
-- NPC: Animated Tachi
-----------------------------------
require("scripts/globals/status");
require("scripts/zones/Dynamis-Xarcabard/TextIDs");
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
if (mob:AnimationSub() == 3) then
SetDropRate(117,1580,1000);
else
SetDropRate(117,1580,0);
end
target:showText(mob,ANIMATED_TACHI_DIALOG);
SpawnMob(17330445,120):updateEnmity(target);
SpawnMob(17330446,120):updateEnmity(target);
SpawnMob(17330447,120):updateEnmity(target);
SpawnMob(17330457,120):updateEnmity(target);
SpawnMob(17330458,120):updateEnmity(target);
SpawnMob(17330459,120):updateEnmity(target);
end;
-----------------------------------
-- onMobFight Action
-----------------------------------
function onMobFight(mob,target)
-- TODO: add battle dialog
end;
-----------------------------------
-- onMobDisengage
-----------------------------------
function onMobDisengage(mob)
mob:showText(mob,ANIMATED_TACHI_DIALOG+2);
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
killer:showText(mob,ANIMATED_TACHI_DIALOG+1);
DespawnMob(17330445);
DespawnMob(17330446);
DespawnMob(17330447);
DespawnMob(17330457);
DespawnMob(17330458);
DespawnMob(17330459);
end; | gpl-3.0 |
dickeyf/darkstar | scripts/globals/gear_sets.lua | 17 | 26319 | -----------------------------------
-- Gear sets
-- Allows the use of gear sets with modifiers
-----------------------------------
require("scripts/globals/status");
-----------------------------------
local matchtype = {
any = 0,
earring_weapon = 1,
weapon_weapon = 2
}
-- placeholder for unknown mod types
local MOD_UNKNOWN = 0;
-- apparently these are static, so i'll leave them here
local extraDamageChance = 35;
local extraAttackChance = 25;
local nullDamageChance = 15;
local instantCastChance = 15;
-- {id, {item, ids, in, no, particular, order}, minimum matches required, match type, mods{id, value, modvalue for each additional match, additional whole set bonus}
local GearSets = {
{id = 1, items = {16092,14554,14969,15633,15719}, matches = 5, matchType = matchtype.any, mods = {{MOD_HASTE_GEAR, 50, 0, 0}} }, -- Usukane's set (5% Haste)
{id = 2, items = {16088,14550,14965,15629,15715}, matches = 5, matchType = matchtype.any, mods = {{MOD_CRITHITRATE, 5, 0, 0}} }, -- Skadi's set (5% critrate is guess)
{id = 3, items = {16084,14546,14961,15625,15711}, matches = 5, matchType = matchtype.any, mods = {{MOD_DOUBLE_ATTACK, 5, 0, 0}} }, -- Ares's set (5% DA)
{id = 4, items = {16107,14569,14984,15648,15734}, matches = 5, matchType = matchtype.any, mods = {{MOD_ACC, 20, 0, 0}} }, -- Denali Jacket Set (Increases Accuracy +20)
{id = 5, items = {16106,14568,14983,15647,15733}, matches = 5, matchType = matchtype.any, mods = {{MOD_HPP, 10, 0, 0}} }, -- Askar Korazin Set (Max HP Boost %10)
{id = 6, items = {16069,14530,14940,15609,15695}, matches = 5, matchType = matchtype.any, mods = {{MOD_SUBTLE_BLOW, 8, 0, 0}} }, -- Pahluwan Khazagand Set (8% is guess)
{id = 7, items = {16100,14562,14977,15641,15727}, matches = 5, matchType = matchtype.any, mods = {{MOD_MATT, 5, 0, 0}} }, -- Morrigan's Robe Set (+5 Magic. Atk Bonus)
{id = 8, items = {16096,14558,14973,15637,15723}, matches = 5, matchType = matchtype.any, mods = {{MOD_FASTCAST, 5, 0, 0}} }, -- Marduk's Jubbah Set (5% fastcast)
{id = 9, items = {16108,14570,14985,15649,15735}, matches = 5, matchType = matchtype.any, mods = {{MOD_MDEF, 10, 0, 0}} }, -- Goliard Saio Set - Total Set Bonus +10% Magic Def. Bonus
{id = 10, items = {16064,14527,14935,15606,15690}, matches = 5, matchType = matchtype.any, mods = {{MOD_REFRESH, 1, 0, 0}} }, -- Yigit Gomlek Set (1mp per tick) Adds "Refresh" effect
{id = 11, items = {11503,13759,12745,14210,11413}, matches = 5, matchType = matchtype.any, mods = {{MOD_HASTE_GEAR, 50, 0, 0}} }, -- Perle Hauberk Set 5% haste
{id = 12, items = {11504,13760,12746,14257,11414}, matches = 5, matchType = matchtype.any, mods = {{MOD_STORETP, 8, 0, 0}} }, -- Aurore Doublet Set store tp +8
{id = 13, items = {11505,13778,12747,14258,11415}, matches = 5, matchType = matchtype.any, mods = {{MOD_FASTCAST, 10, 0, 0}} }, -- Teal Saio Set fastcast 10%
{id = 14, items = {10890,10462,10512,11980,10610}, matches = 5, matchType = matchtype.any, mods = {{MOD_HASTE_GEAR, 60, 0, 0}} }, -- Calma Armor Set haste%6
{id = 15, items = {10892,10464,10514,11982,10612}, matches = 5, matchType = matchtype.any, mods = {{MOD_MACC, 5, 0, 0}} }, -- Magavan Armor Set magic accuracy +5
{id = 16, items = {10891,10463,10513,11981,10611}, matches = 5, matchType = matchtype.any, mods = {{MOD_CRITHITRATE, 5, 0, 0}} }, -- Mustela Harness Set crit rate 5%
{id = 17, items = {16126,15744}, matches = 2, matchType = matchtype.any, mods = {{MOD_RATT, 15, 0, 0}} }, -- Bowman's set: Ranged atk +15
{id = 18, items = {16147,14589,15010,16316,15756}, matches = 2, matchType = matchtype.any, mods = {{MOD_ATT, 1, 4.7, 0}} }, -- Fourth Division Brune Set
{id = 19, items = {16148,14590,15011,16317,15757}, matches = 2, matchType = matchtype.any, mods = {{MOD_COUNTER, 1, 1, 0}} }, -- Cobra Unit Harness Set
{id = 20, items = {16149,14591,15012,16318,15758}, matches = 2, matchType = matchtype.any, mods = {{MOD_MACC, 1, 1, 0}} }, -- Cobra Unit Robe Set
{id = 21, items = { 6141,14581,15005,16312,15749}, matches = 2, matchType = matchtype.any, mods = {{MOD_ACC, 1, 1, 0}, {MOD_ATT, 1, 1, 0}} }, -- Iron Ram Chainmail Set. Double mod here! It is why it has 2 IDs.
{id = 23, items = {16142,14582,15006,16313,15750} , matches = 2, matchType = matchtype.any, mods = {{MOD_HP, 10, 10, 0}} }, -- Fourth Division Cuirass Set
{id = 24, items = {16143,14583,15007,16314,15751} , matches = 2, matchType = matchtype.any, mods = {{MOD_MP, 10, 10, 0}} }, -- Cobra Unit Coat Set
{id = 25, items = {16062,14525,14933,15604,15688} , matches = 5, matchType = matchtype.any, mods = {{MOD_UDMGBREATH, -8, 0, 0}, {MOD_UDMGMAGIC, -8, 0, 0}} }, -- Amir Korazin Set - Double mod here! It is why it has 2 IDs.
{id = 27, items = {11281,15015,16337,11364}, matches = 2, matchType = matchtype.any, mods = {{MOD_STORETP, 5, 5, 5}} }, -- Hachiryu Haramaki Set - Store tp
{id = 28, items = {11064,11084,11104,11124,11144}, matches = 5, matchType = matchtype.any, mods = {{MOD_DA_DOUBLE_DAMAGE, 5, 0, 0}} }, -- Ravager's Armor +2 Set - Double attack double damage chance
{id = 29, items = {11808,11824,11850,11857,11858}, matches = 2, matchType = matchtype.any, mods = {{MOD_DOUBLE_ATTACK, 5, 0, 0}} }, -- Fazheluo Mail Set. Set Bonus: "Double Attack"+5%. Active with any 2 pieces.
{id = 30, items = {11809,11825,11851,11855,11859}, matches = 2, matchType = matchtype.any, mods = {{MOD_HASTE_GEAR, 80, 0, 0}} }, -- Cuauhtli Harness Set. Set Bonus: Haste+8%. Active with any 2 pieces.
{id = 31, items = {11810,11826,11852,11856,11860}, matches = 2, matchType = matchtype.any, mods = {{MOD_MACC, 5, 0, 0}} }, -- Hyskos Robe Set. Set Bonus: Magic Accuracy+5. Active with any 2 pieces.
{id = 32, items = {10876,10450,10500,11969,10600}, matches = 2, matchType = matchtype.any, mods = {{MOD_REFRESH, 1, 0.4, 0}} }, -- Ogier's Armor Set. Set Bonus: Adds "Refresh" Effect. Provides 1 mp/tick for 2-3 pieces worn, 2 mp/tick for 4-5 pieces worn.
{id = 33, items = {10877,10451,10501,11970,10601}, matches = 2, matchType = matchtype.any, mods = {{MOD_CRITHITRATE, 1, 1, 0}} }, -- Athos's Armor Set. Set Bonus: Increases rate of critical hits. Gives +3% for the first 2 pieces and +1% for every additional piece.
-- hipster set, stick it in HipsterSets below so we can handle it separately (still need to check if it's a set, though)
{id = 34, items = {10878,10452,10502,11971,10602}, matches = 5, matchType = matchtype.any, mods = {{MOD_FASTCAST, 10, 0, 0}} }, -- Rubeus Armor Set. Set Bonus: Enhances "Fast Cast" Effect. 2 or 3 pieces equipped: Fast Cast +4, 4 or 5 pieces equipped: Fast Cast +10
{id = 35, items = {11080,11100,11120,11140,11160}, matches = 5, matchType = matchtype.any, mods = {{MOD_QUICK_DRAW_TRIPLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Navarch's Attire +2 Set. Set Bonus: Augments "Quick Draw". Quick Draw will occasionally deal triple damage.
{id = 36, items = {11082,11102,11122,11142,11162}, matches = 2, matchType = matchtype.any, mods = {{MOD_SAMBA_DOUBLE_DAMAGE, 1, 1.8, 0}} }, -- Charis Attire +2 Set. Set Bonus: Augments "Samba". Occasionally doubles damage with Samba up. Adds approximately 1-2% per piece past the first.
{id = 37, items = {11076,11096,11116,11136,11156}, matches = 5, matchType = matchtype.any, mods = {{MOD_EXTRA_DUAL_WIELD_ATTACK, extraAttackChance, 0, 0}} }, -- Iga Garb +2 Set. Set Bonus: Augments "Dual Wield". Attacks made while dual wielding occasionally add an extra attack
{id = 38, items = {11074,11094,11114,11134,11154}, matches = 2, matchType = matchtype.any, mods = {{MOD_RAPID_SHOT_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Sylvan Attire +2 Set. Set Bonus: Augments "Rapid Shot". Rapid Shots occasionally deal double damage.
{id = 39, items = {11070,11090,11110,11130,11150}, matches = 5, matchType = matchtype.any, mods = {{MOD_ABSORB_DMG_CHANCE, 1, 1, 0}} }, -- Creed Armor +2 Set. Set Bonus: Occasionally absorbs damage taken. Set proc believed to be somewhere around 5%, more testing needed. Verification Needed Absorb rate likely varies with # of set pieces.
{id = 40, items = {11075,11095,11115,11135,11155}, matches = 5, matchType = matchtype.any, mods = {{MOD_ZANSHIN_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Unkai Domaru +2 Set. Set Bonus: Augments "Zanshin". Zanshin attacks will occasionally deal double damage.
{id = 41, items = {11065,11085,11105,11125,11145}, matches = 5, matchType = matchtype.any, mods = {{MOD_EXTRA_KICK_ATTACK, extraAttackChance, 0, 0}} }, -- Tantra Attire +2 Set. Set Bonus: Augments "Kick Attacks". Occasionally allows a second Kick Attack during an attack round without the use of Footwork.
{id = 42, items = {11069,11089,11109,11129,11149}, matches = 2, matchType = matchtype.any, mods = {{MOD_TA_TRIPLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Raider's Attire +2 Set. Set Bonus: Augments "Triple Attack". Occasionally causes the second and third hits of a Triple Attack to deal triple damage.Verification Needed Requires a minimum of two pieces.
{id = 43, items = {11066,11086,11106,11126,11146}, matches = 5, matchType = matchtype.any, mods = {{MOD_BAR_ELEMENT_NULL_CHANCE, nullDamageChance, 0, 0}} }, -- Orison Attire +2 Set. Set Bonus: Augments elemental resistance spells. Bar Elemental spells will occasionally nullify damage of the same element.
{id = 44, items = {11083,11103,11123,11143,11163}, matches = 5, matchType = matchtype.any, mods = {{MOD_GRIMOIRE_INSTANT_CAST, instantCastChance, 0, 0}} }, -- Savant's Attire +2 Set. Set Bonus: Augments Grimoire. Spells that match your current Arts will occasionally cast instantly, without recast.
{id = 45, items = {16005, 17756, 17962, 18596, 18760, 19112, 19215, 19271, 19156}, matches = 2, matchType = matchtype.earring_weapon, mods = {{MOD_HP, 30, 0, 0}, {MOD_VIT, 6, 0, 0}, {MOD_ACC, 6, 0, 0}, {MOD_RACC, 6, 0, 0}} }, -- Paramount Earring Sets. Set Bonus: HP+30, VIT+6, Accuracy+6, Ranged Accuracy+6. Set Bonus is active with any 2 items(Earring+Weapon or Weapon+Weapon)
{id = 45, items = {17756, 17962, 18596, 18760, 19112, 19215, 19271, 19156}, matches = 2, matchType = matchtype.weapon_weapon, mods = {{MOD_HP, 30, 0, 0}, {MOD_VIT, 6, 0, 0}, {MOD_ACC, 6, 0, 0}, {MOD_RACC, 6, 0, 0}} }, -- Paramount Earring Sets. Set Bonus: HP+30, VIT+6, Accuracy+6, Ranged Accuracy+6. Set Bonus is active with any 2 items(Earring+Weapon or Weapon+Weapon)
{id = 49, items = {18761,18597,17757,19218,18128,18500,16004,18951}, matches = 2, matchType = matchtype.earring_weapon, mods = {{MOD_STR, 6, 0, 0}, {MOD_ATT, 4, 0, 0}, {MOD_RATT, 4, 0, 0}, {MOD_MATT, 2, 0, 0}} }, -- Supremacy Earring Sets. Set Bonus: STR+6, Attack+4, Ranged Attack+4, "Magic Atk. Bonus"+2. Active with any 2 items(Earring+Weapon)
{id = 53, items = {16006,18450,18499,18861,18862,18952,19111,19217,19272}, matches = 2, matchType = matchtype.earring_weapon, mods = {{MOD_EVA, 10, 0, 0}, {MOD_HPHEAL, 10, 0, 0}, {MOD_ENMITY, -5, 0, 0}} }, -- Brilliant Earring Set. Set Bonus: Evasion, HP Recovered while healing, Reduces Emnity. Active with any 2 items(Earring+Weapon)
{id = 56, items = {11798,11362}, matches = 2, matchType = matchtype.any, mods = {{MOD_RERAISE_III, 1, 0, 0}} }, -- Twilight Mail Set. Set Bonus: Auto-Reraise
{id = 57, items = {18244,17595}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} }, -- Begin Jailer weapons: Set is weapon + Virtue stone, bonus 50% extra melee swing.
{id = 58, items = {18244,17710}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} },
{id = 59, items = {18244,17948}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} },
{id = 60, items = {18244,18100}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} },
{id = 61, items = {18244,18222}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} },
{id = 62, items = {18244,18360}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} },
{id = 63, items = {18244,18397}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} }, -- End Jailer weapons
{id = 71, items = {28520,28521}, matches = 2, matchType = matchtype.any, mods = {{MOD_DOUBLE_ATTACK, 7, 0, 0}} }, -- Bladeborn/Steelflash Earrings
{id = 72, items = {28522,28523}, matches = 2, matchType = matchtype.any, mods = {{MOD_DUAL_WIELD, 7, 0, 0}} }, -- Dudgeon/Heartseeker Earrings
{id = 73, items = {28524,28525}, matches = 2, matchType = matchtype.any, mods = {{MOD_MACC, 12, 0, 0}} }, -- Psystorm/Lifestorm Earrings
{id = 74, items = {26920,26921,27434,27259,27260,26762,26763,27074,27075,27433}, matches = 2, matchType = matchtype.any, mods = {{MOD_ZANSHIN_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Samurai 109/119 af3
{id = 75, items = {27414,27413,27240,27239,27055,27054,26901,26900,26743,26742}, matches = 2, matchType = matchtype.any, mods = {{MOD_EXTRA_KICK_ATTACK, extraAttackChance, 0, 0}} }, -- MNK 109/119 af3
{id = 76, items = {26740,26741,27411,27412,27238,27237,27053,27054,26899,26900}, matches = 2, matchType = matchtype.any, mods = {{MOD_DA_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- 109/119 WAR AF3
{id = 77, items = {26750,26751,27421,27422,27247,27248,27063,27062,26908,26909}, matches = 2, matchType = matchtype.any, mods = {{MOD_TA_TRIPLE_DAMAGE, extraDamageChance, 0, 0}} }, -- 109/119 THF AF3
{id = 78, items = {26918,26919,26761,26762,27431,27432,27257,27258,27072,27073}, matches = 2, matchType = matchtype.any, mods = {{MOD_RAPID_SHOT_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- 109/119 RNG AF3
{id = 79, items = {26910,26911,26752,26753,27424,27423,27064,27065,27249,27250}, matches = 2, matchType = matchtype.any, mods = {{MOD_ABSORB_DMG_CHANCE, nullDamageChance, 0, 0}} }, -- 109/119 PLD AF3
{id = 80, items = {26922,26923,26764,26765,27076,27077,27261,27262,27435,27436}, matches = 2, matchType = matchtype.any, mods = {{MOD_EXTRA_DUAL_WIELD_ATTACK, extraAttackChance, 0, 0}} }, -- 109/119 NIN AF3
{id = 81, items = {27443,27444,26772,26773,26930,26931,27084,27085,27269,27270}, matches = 2, matchType = matchtype.any, mods = {{MOD_QUICK_DRAW_TRIPLE_DAMAGE, extraDamageChance, 0, 0}} }, -- 109/119 COR AF3
{id = 82, items = {27275,27276,27449,27450,26778,26779,26936,26937,27090,27091}, matches = 2, matchType = matchtype.any, mods = {{MOD_GRIMOIRE_INSTANT_CAST, instantCastChance, 0, 0}} }, -- 109/119 SCH AF3
{id = 83, items = {27241,27242,27415,27416,26744,26745,26902,26903,27056,27057}, matches = 2, matchType = matchtype.any, mods = {{MOD_BAR_ELEMENT_NULL_CHANCE, nullDamageChance, 0, 0}} }, -- 109/119 WHM AF3
{id = 84, items = {11867,10868,10865}, matches = 2, matchType = matchtype.any, mods = {{MOD_REFRESH, 3, 0, 0}} }, -- Heka's body + NQ or HQ Khat = 3 tick refresh
{id = 85, items = {10868,11870,11864,10865}, matches = 2, matchType = matchtype.any, mods = {{MOD_REFRESH, 2, 0, 0}} }, -- Nefer body/head NQ/HQ combo gives Refresh +2
{id = 86, items = {15852,15853}, matches = 2, matchType = matchtype.any, mods = {{MOD_HP, 50, 0, 0},{MOD_MP, 50, 0, 0}} }, -- Dasra's/Nasatya's Ring set gives HP/MP +50
{id = 88, items = {16037,16038}, matches = 2, matchType = matchtype.any, mods = {{MOD_MATT, 5, 0, 0},{MOD_MACC, 5, 0, 0}} }, -- Helenus's/Cassandra's earring set: Mag atk bonus+5 and Mag acc +5
{id = 90, items = {15850,15851}, matches = 2, matchType = matchtype.any, mods = {{MOD_ATT, 6, 0, 0},{MOD_ACC, 12, 0, 0},{MOD_DEF, 6, 0, 0}} }, -- Lava's/Kusha's earring set: Atk+6/Acc+12
{id = 93, items = {16146,14588,15009,16315,15755}, matches = 2, matchType = matchtype.any, mods = {{MOD_FIRERES, 5, 5, 10},{MOD_ICERES, 5, 5, 10},{MOD_WINDRES, 5, 5, 10},{MOD_EARTHRES, 5, 5, 10},{MOD_THUNDERRES, 5, 5, 10},{MOD_WATERRES, 5, 5, 10},{MOD_LIGHTRES, 5, 5, 10},{MOD_DARKRES, 5, 5, 10}} }, -- Iron Ram Haubert Set
{id = 101, items = {16035,16036}, matches = 2, matchType = matchtype.any, mods = {{MOD_AGI, 8, 0, 0}} }, -- Altdorf's/Wilhelm's earring: AGI+8
{id = 102, items = {15042,11402}, matches = 2, matchType = matchtype.any, mods = {{MOD_ATT, 5, 0, 0},{MOD_RATT, 5, 0, 0}} }, -- Gothic Gauntlets/Sabatons: Atk/RAtk +5
}
-- increment id by (number of mods in previous gearset - 1)
-- {id, {item, ids, in, no, particular, order}, minimum matches required, match type, mods{id, value, modvalue for each additional match, additional whole set bonus}
local HipsterSets = {
-- stick the ids of sets that need their own handling here e.g. Rubeus
{id = 34, hipster = true}
}
------------------------------------------
-- Checks for gear sets present on a player
-------------------------------------------
function checkForGearSet(player)
-- print("---Removed existing gear set mods!---\n");
player:clearGearSetMods();
-- cause we dont want hundreds of function calls
local equip = {};
for slot = 0, MAX_SLOTID do
equip[slot+1] = player:getEquipID(slot);
end
for index, gearset in pairs(GearSets) do
local matches = 0;
if (player:hasGearSetMod(gearset.id) == false) then
local slot = 0;
local gearMatch = {};
for _, id in pairs(gearset.items) do
for slot = 1, MAX_SLOTID do
local equipId = equip[slot];
-- check the item matches
if (equipId == id) then
matches = matches + 1;
gearMatch[slot] = equipId;
break;
end
end;
end
-- doesnt count as a match if the same item is in both slots
if (gearMatch[SLOT_EAR1+1] == gearMatch[SLOT_EAR2+1] and gearMatch[SLOT_EAR1+1] ~= nil) then
matches = matches - 1;
end;
if (gearMatch[SLOT_RING1+1] == gearMatch[SLOT_RING2+1] and gearMatch[SLOT_RING1+1] ~= nil) then
matches = matches - 1;
end;
if (gearMatch[SLOT_MAIN+1] == gearMatch[SLOT_SUB+1] and gearMatch[SLOT_MAIN+1] ~= nil) then
matches = matches - 1;
end;
if (matches >= gearset.matches) then
if (FindMatchByType(gearset, gearMatch) == true) then
ApplyMod(player, gearset, matches)
end
end
end
end
end;
function FindMatchByType(gearset, gearMatch)
if (gearset.matchType == matchtype.any) then
return true;
end
for _, id in ipairs(gearMatch) do
if (gearset.matchType == matchtype.earring_weapon and (gearMatch[SLOT_MAIN+1] ~= nil or gearMatch[SLOT_SUB+1] ~= nil) and (gearMatch[SLOT_EAR1+1] ~= nil or gearMatch[SLOT_EAR2+1] ~= nil)) then
return true;
elseif (gearset.matchType == matchtype.weapon_weapon and (gearMatch[SLOT_MAIN+1] ~= nil and gearMatch[SLOT_SUB+1] ~= nil)) then
return true;
end
end
return false;
end;
---------------------------------------
-- Applys a gear set mod
---------------------------------------
function ApplyMod(player, gearset, matches)
for _, set in pairs(HipsterSets) do
if (set.id == gearset.id) then
HandleHipsterSet(player, gearset, matches);
return;
end
end
-- find any additional matches
local addMatches = matches - gearset.matches;
-- just in case some d00d decides to custom shit up and complain the script is b0rked
if (addMatches < 0) then
printf("shitbag check your code | gearset: %u", gearset.id);
return;
end;
local i = 0;
for _, mod in pairs(gearset.mods) do
local modId = mod[1];
local modValue = mod[2];
-- value/multiplier for additional pieces
local addMatchValue = mod[3];
-- additional bonus for complete set
local addSetBonus = 0;
-- cause we need all pieces to form a complete set
if (matches == #gearset.items) then
addSetBonus = mod[4];
end;
-- add bonus mods per piece
if (addMatches ~= 0 and addMatchValue ~= 0) then
modValue = modValue + (addMatchValue * addMatches);
end
-- printf("gearset: %u, mod: %u, value %u", gearset.id, modId, modValue + addSetBonus);
player:addGearSetMod(gearset.id + i, modId, modValue + addSetBonus);
i = i + 1;
end
-- print("Gear set! Mod applied: ModNameId:" .. modNameId .. " ModId:" .. modId .. " Value:" .. modValue .. "\n");
end;
-- fkin hipsters
function HandleHipsterSet(player, gearset, matches)
-- Rubeus Armor Set
if (gearset.id == 34) then
local modValue = 0;
if (matches > 1 and matches < 4) then
modValue = 4; -- 2 or 3 pieces
elseif (matches > 3) then
modValue = 10; -- 4 or 5 pieces
end;
-- printf("we have a special snowflake | gearset: %u | mod %u %u", gearset.id, MOD_FASTCAST, modValue);
player:addGearSetMod(gearset.id, MOD_FASTCAST, modValue);
return;
end
end
--[[ Unimplemented sets below
=======
Stronghold NM(WOTG)
=======
-- Molione's Sickle Set
-------------
18947 -- Molione's Sickle
15818 -- Molione's Ring
-- Set Bonus: +5 Accuracy
-- Set Bonus: Enhances "Souleater" Effect
=======
Empyrean +2
=======
--Aoidos' Attire +2 Set
-------------
11073 -- Aoidos' Calot+2
11093 -- Aoidos' Hongreline +2
11113 -- Aoidos' Manchettes +2
11133 -- Aoidos' Rhingrave +2
11153 -- Aoidos' Cothurnes +2
-- Set Bonus: Augments Songs
-- Enhancing songs add an attribute bonus that corresponds to the element of the song (i.e. Thunder-based songs add +DEX). The attribute bonus begins at +1 for 2 pieces, increases by 1 for each additional piece, up to +5 for the whole set. For Dark-based songs, there is a bonus of +10 MP for 2 pieces, and increases by 10 for each additional piece.
--Ferine' Attire +2 Set
-------------
11072 -- Ferine Cabasset+2
11092 -- Ferine Gausape+2
11112 -- Ferine Manoplas+2
11132 -- Ferine Quijotes+2
11152 -- Ferine Ocreae+2
-- Set Bonus: Attack occ. varies with pet's HP
-- Occasionally increases damage in direct proportion to the percentage of pet's current HP. At 100% HP, damage is doubled when triggered, at 50% HP, damage increases by 50%, and so on.
-- 5% Proc Rate
--Goetia Attire +2 Set
-------------
11067 -- Goetia Petasos+2
11087 -- Goetia Coat+2
11107 -- Goetia Gloves+2
11127 -- Goetia Chausses+2
11147 -- Goetia Sabots+2
-- Set Bonus: Augments "Conserve MP"
-- Occasionally increases damage of elemental spells when Conserve MP is triggered. Increased amount is proportional to twice the ratio of MP conserved.
--Mavi Attire +2 Set
-------------
11079 -- Mavi Kavuk+2
11099 -- Mavi Mintan+2
11119 -- Mavi Bazubands+2
11139 -- Mavi Tayt+2
11159 -- Mavi Basmak+2
-- Set Bonus: Occ. augments blue magic spells.
-- no damn clue!
--Bale Armor +2 Set
-------------
11071 -- Bale Burgeonet+2
11091 -- Bale Cuirass+2
11111 -- Bale Gauntlets+2
11131 -- Bale Flanchard+2
11151 -- Bale Sollerets+2
-- Set Bonus: Attack occasionally varies with HP
-- Occasionally increases damage in direct proportion to the percentage of current HP. At 100% HP, damage is doubled when triggered, at 50% HP, damage increases by 50%, and so on.
--Lancer's Armor +2 Set
-------------
11077 -- Lancer's Mezail+2
11097 -- Lancer's Plackart+2
11117 -- Lancer's Vambrace+2
11137 -- Lancer's Cuissots+2
11157 -- Lancer's Schynbalds+2
-- Set Bonus: Attack occasionally varies with wyvern's HP.
-- Damage increases proportionate to Wyvern's HP, at 100%, damage is doubled. 2+ pieces required, more pieces increase proc rate. Full +2 set is about a 10% proc rate. (Confirmation needed)
--Cirque Attire +2 Set
-------------
11081 -- Cirque Capello+2
11101 -- Cirque Farsetto+2
11121 -- Cirque Gaunti+2
11141 -- Cirque Pantaloni+2
11161 -- Cirque Scarpe+2
-- Set Bonus: Attack occasionally varies with automaton's HP.
-- Occasionally increases damage in direct proportion to the percentage of Automaton's current HP. At 100% HP, damage is doubled when triggered, at 50% HP, damage increases by 50%, and so on.
--Estoqueur's Attire +2 Set
-------------
11068 -- Estoqueur's Chappel+2
11088 -- Estoqueur's Sayon+2
11108 -- Estoqueur's Gantherots+2
11128 -- Estoqueur's Fuseau+2
11148 -- Estoqueur's Houseaux+2
-- Set Bonus: Augments "Composure"
-- Enhances duration of Enhancing Magic cast on OTHERS while under the effect of Composure by 10% for the first 2 pieces, and 15% for any additional pieces thereafter, up to 35% increase for 4 pieces and 50% for all 5 pieces. The "Increases enhancing magic effect duration" of the Estoqueur's Cape, Estoqueur's Houseaux +1 and Estoqueur's Houseaux +2 is multiplicative to this total.
--Caller's Attire +2 Set
-------------
11078 -- Caller's Horn+2
11098 -- Caller's Doublet+2
11118 -- Caller's Bracers+2
11138 -- Caller's Spats+2
11158 -- Caller's Pigaches+2
-- Set Bonus: Augments "Blood Boon"
-- Occasionally increases damage of Blood Pacts when Blood Boon is triggered. Increased amount is proportional to the ratio of MP conserved.
]]--
| gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c47693640.lua | 4 | 4252 | --ゾンビタイガー
function c47693640.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(47693640,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c47693640.eqtg)
e1:SetOperation(c47693640.eqop)
c:RegisterEffect(e1)
--unequip
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(47693640,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(aux.IsUnionState)
e2:SetTarget(c47693640.sptg)
e2:SetOperation(c47693640.spop)
c:RegisterEffect(e2)
--Atk up
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(500)
e3:SetCondition(aux.IsUnionState)
c:RegisterEffect(e3)
--Def up
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP)
e4:SetCode(EFFECT_UPDATE_DEFENSE)
e4:SetValue(500)
e4:SetCondition(aux.IsUnionState)
c:RegisterEffect(e4)
--handes
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(47693640,2))
e5:SetCategory(CATEGORY_HANDES)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e5:SetRange(LOCATION_SZONE)
e5:SetCode(EVENT_BATTLE_DESTROYING)
e5:SetCondition(c47693640.hdcon)
e5:SetTarget(c47693640.hdtg)
e5:SetOperation(c47693640.hdop)
c:RegisterEffect(e5)
--destroy sub
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_EQUIP)
e6:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e6:SetCode(EFFECT_DESTROY_SUBSTITUTE)
e6:SetCondition(aux.IsUnionState)
e6:SetValue(c47693640.repval)
c:RegisterEffect(e6)
--eqlimit
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_SINGLE)
e7:SetCode(EFFECT_EQUIP_LIMIT)
e7:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e7:SetValue(c47693640.eqlimit)
c:RegisterEffect(e7)
end
c47693640.old_union=true
function c47693640.repval(e,re,r,rp)
return bit.band(r,REASON_BATTLE)~=0
end
function c47693640.eqlimit(e,c)
return c:IsCode(10209545)
end
function c47693640.filter(c)
return c:IsFaceup() and c:IsCode(10209545) and c:GetUnionCount()==0
end
function c47693640.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c47693640.filter(chkc) end
if chk==0 then return e:GetHandler():GetFlagEffect(47693640)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c47693640.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c47693640.filter,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
e:GetHandler():RegisterFlagEffect(47693640,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c47693640.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
if not tc:IsRelateToEffect(e) or not c47693640.filter(tc) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
if not Duel.Equip(tp,c,tc,false) then return end
aux.SetUnionState(c)
end
function c47693640.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(47693640)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
e:GetHandler():RegisterFlagEffect(47693640,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c47693640.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_ATTACK)
end
function c47693640.hdcon(e,tp,eg,ep,ev,re,r,rp)
return aux.IsUnionState(e) and eg:GetFirst()==e:GetHandler():GetEquipTarget()
end
function c47693640.hdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_HANDES,0,0,1-tp,1)
end
function c47693640.hdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if g:GetCount()==0 then return end
local sg=g:RandomSelect(1-tp,1)
Duel.SendtoGrave(sg,REASON_DISCARD+REASON_EFFECT)
end
| gpl-2.0 |
Turttle/darkstar | scripts/zones/Phomiuna_Aqueducts/npcs/_0rw.lua | 17 | 1304 | -----------------------------------
-- Area: Phomiuna_Aqueducts
-- NPC: _0rw (Oil Lamp)
-- Notes: Opens south door at J-9 from inside.
-- @pos 103.703 -26.180 83.000 27
-----------------------------------
package.loaded["scripts/zones/Phomiuna_Aqueducts/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Phomiuna_Aqueducts/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local DoorOffset = npc:getID() - 1;
if (GetNPCByID(DoorOffset):getAnimation() == 9) then
if (player:getZPos() < 85) then
npc:openDoor(7); -- torch animation
GetNPCByID(DoorOffset):openDoor(7); -- _0rh
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end; | gpl-3.0 |
Turttle/darkstar | scripts/zones/Abyssea-Attohwa/npcs/Cavernous_Maw.lua | 17 | 1245 | -----------------------------------
-- Area: Abyssea - Attohwa
-- NPC: Cavernous Maw
-- @pos -133.197 20.242 -181.658 215
-- Notes: Teleports Players to Buburimu Peninsula
-----------------------------------
package.loaded["scripts/zones/Abyssea-Attohwa/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Abyssea-Attohwa/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x00c8);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x00c8 and option == 1) then
player:setPos(-338,-23,47,167,118);
end
end; | gpl-3.0 |
Turttle/darkstar | scripts/zones/Spire_of_Dem/npcs/_0j1.lua | 51 | 1321 | -----------------------------------
-- Area: Spire_of_Dem
-- NPC: web of regret
-----------------------------------
package.loaded["scripts/zones/Spire_of_Dem/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/bcnm");
require("scripts/zones/Spire_of_Dem/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (TradeBCNM(player,player:getZoneID(),trade,npc)) then
return;
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (EventTriggerBCNM(player,npc)) then
return 1;
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("onUpdate CSID: %u",csid);
--printf("onUpdate RESULT: %u",option);
if (EventUpdateBCNM(player,csid,option)) then
return;
end
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
--printf("onFinish CSID: %u",csid);
--printf("onFinish RESULT: %u",option);
if (EventFinishBCNM(player,csid,option)) then
return;
end
end; | gpl-3.0 |
Turttle/darkstar | scripts/zones/Spire_of_Dem/npcs/_0j2.lua | 51 | 1321 | -----------------------------------
-- Area: Spire_of_Dem
-- NPC: web of regret
-----------------------------------
package.loaded["scripts/zones/Spire_of_Dem/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/bcnm");
require("scripts/zones/Spire_of_Dem/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (TradeBCNM(player,player:getZoneID(),trade,npc)) then
return;
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (EventTriggerBCNM(player,npc)) then
return 1;
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("onUpdate CSID: %u",csid);
--printf("onUpdate RESULT: %u",option);
if (EventUpdateBCNM(player,csid,option)) then
return;
end
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
--printf("onFinish CSID: %u",csid);
--printf("onFinish RESULT: %u",option);
if (EventFinishBCNM(player,csid,option)) then
return;
end
end; | gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c71544954.lua | 4 | 1526 | --メガロック・ドラゴン
function c71544954.initial_effect(c)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(71544954,0))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c71544954.spcon)
e1:SetOperation(c71544954.spop)
c:RegisterEffect(e1)
--cannot special summon
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e2)
end
function c71544954.spfilter(c)
return c:IsRace(RACE_ROCK) and c:IsAbleToRemoveAsCost()
end
function c71544954.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c71544954.spfilter,tp,LOCATION_GRAVE,0,1,nil)
end
function c71544954.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c71544954.spfilter,tp,LOCATION_GRAVE,0,1,63,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
local val=g:GetCount()*700
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetReset(RESET_EVENT+0xff0000)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetValue(val)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_BASE_DEFENSE)
c:RegisterEffect(e2)
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c68670547.lua | 9 | 1286 | --闇竜の黒騎士
function c68670547.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(68670547,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(c68670547.sptg)
e1:SetOperation(c68670547.spop)
c:RegisterEffect(e1)
end
function c68670547.filter(c,e,tp)
return c:IsLevelBelow(4) and c:IsRace(RACE_ZOMBIE)
and c:IsReason(REASON_BATTLE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c68670547.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and c68670547.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c68670547.filter,tp,0,LOCATION_GRAVE,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c68670547.filter,tp,0,LOCATION_GRAVE,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c68670547.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsRace(RACE_ZOMBIE) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
dickeyf/darkstar | scripts/zones/Bibiki_Bay/npcs/Warmachine.lua | 13 | 2034 | -----------------------------------
-- Area: Bibiki Bay
-- NPC: Warmachine
-- @zone 4
-- @pos -345.236 -3.188 -976.563 4
-----------------------------------
package.loaded["scripts/zones/Bibiki_Bay/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/zones/Bibiki_Bay/TextIDs");
require("scripts/globals/missions");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local ColoredDrop = 4258+math.random(0,7);
-- COP mission
if (player:getCurrentMission(COP) == THREE_PATHS and player:getVar("COP_Louverance_s_Path") == 2) then
player:startEvent(0x0021);
elseif (player:getCurrentMission(COP) == DAWN and player:getVar("COP_3-taru_story")== 1) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,ColoredDrop);
else
player:setVar("ColoredDrop",ColoredDrop);
player:startEvent(0x002B);
end
-- standard dialog
else
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x0021) then
player:setVar("COP_Louverance_s_Path",3);
elseif (csid == 0x002B) then
local ColoredDropID=player:getVar("ColoredDrop");
player:addItem(ColoredDropID);
player:messageSpecial(ITEM_OBTAINED,ColoredDropID);
player:setVar("COP_3-taru_story",2);
player:setVar("ColoredDrop",0);
end
end; | gpl-3.0 |
mchaza/soka | src/menu.lua | 1 | 14709 | require 'libraries/vector'
require 'libraries/xboxlove'
Menu = {}
function Menu:new()
local instance = {}
setmetatable(instance, self)
self.__index = self
instance.active = true
instance.scorelimit = 11
instance.win = false
instance.fullscreen = false
instance.fullscreen_option = false
instance.resolution_index = math.floor(#resolutions/2)
instance.resolution_option = math.floor(#resolutions/2)
instance.menu_index = 1
instance.joystick_delay = 0.2
instance.joystick_timer = 0.0
if love.joystick.isOpen( 1 ) then
instance.controller1 = xboxlove.create(1)
instance.controller1:setDeadzone("ALL",0.2)
end
if love.joystick.isOpen( 2 ) then
instance.controller2 = xboxlove.create(2)
instance.controller2:setDeadzone("ALL",0.2)
end
instance.start = nil
instance.startCheer = nil
instance.titleFont, instance.menuFont = nil, nil
instance:setFonts()
instance.particles = {}
instance.particle_min_size = 1.25
return instance
end
function Menu:setFonts()
scalefactor.x = love.graphics.getWidth() / 100
scalefactor.y = love.graphics.getHeight() / 100
self.titleFont = love.graphics.newFont('assets/visitor1.ttf', 20 * scalefactor.x)
self.menuFont = love.graphics.newFont('assets/visitor1.ttf', 3.5 * scalefactor.x)
end
function Menu:draw()
self:draw_title()
self:draw_menu()
for _, particle in ipairs(self.particles) do
if particle.transparency > 0 then
particle:draw()
end
end
end
function Menu:update(dt)
scalefactor = {x, y}
scalefactor.x = love.graphics.getWidth() / 100
scalefactor.y = love.graphics.getHeight() / 100
if love.joystick.isOpen( 1 ) then
self.controller1:update(dt)
self:joystick_input(dt, self.controller1)
end
if love.joystick.isOpen( 2 ) then
self.controller2:update(dt)
self:joystick_input(dt, self.controller2)
end
--[[self:create_particles()
local dead = {}
for i=1, #self.particles do
self.particles[i]:update(dt)
if self.particles[i].transparency <= 0 then
table.insert(dead, i)
end
end
for i=1, #dead do
table.remove(self.particles, dead[i])
end]]
end
function Menu:input(k)
if k == ' ' then
menu.active = false
if self.start ~= nil then
love.audio.stop( self.start)
end
self.start = loadSound("start")
love.audio.play( self.start)
Main:load()
end
if k == 'down' then
if self.menu_index < 4 then
self.menu_index = self.menu_index + 1
local menuSelect = loadSound("menuSelect")
love.audio.play(menuSelect)
end
end
if k == 'up' then
if self.menu_index > 1 then
self.menu_index = self.menu_index - 1
local menuSelect = loadSound("menuSelect")
love.audio.play(menuSelect)
end
end
if self.menu_index == 2 then
if k == 'right' then
if self.scorelimit < 99 then
self.scorelimit = self.scorelimit + 2
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
elseif k == 'left' then
if self.scorelimit > 1 then
self.scorelimit = self.scorelimit - 2
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
end
end
if self.menu_index == 3 then
if k == 'right' then
self.fullscreen_option = not self.fullscreen_option
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
elseif k == 'left' then
self.fullscreen_option = not self.fullscreen_option
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
else
if self.fullscreen_option ~= self.fullscreen then
self.fullscreen_option = self.fullscreen
end
end
if self.menu_index == 4 then
if k == 'right' then
if self.resolution_option > 1 then
self.resolution_option = self.resolution_option - 1
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
elseif k == 'left' then
if self.resolution_option < #resolutions then
self.resolution_option = self.resolution_option + 1
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
end
else
if self.resolution_option ~= self.resolution_index then
self.resolution_option = self.resolution_index
end
end
if k == 'return' then
if self.menu_index == 1 then
if self.start ~= nil then
love.audio.stop( self.start)
end
self.start = loadSound("start")
love.audio.play( self.start)
self.startCheer = loadSound("cheering")
love.audio.play( self.startCheer)
self.active = false
menu.win = false
Main:load()
elseif self.menu_index == 3 then
if self.fullscreen_option then
if not self.fullscreen then
self.fullscreen = true
self.resolution_index = 1
love.graphics.setMode(resolutions[self.resolution_index].width,
resolutions[self.resolution_index].height, self.fullscreen)
self:setFonts()
end
elseif not self.fullscreen_option then
if self.fullscreen then
self.fullscreen = false
self.resolution_index = math.floor(#resolutions/2)
love.graphics.setMode(resolutions[self.resolution_index].width,
resolutions[self.resolution_index].height, self.fullscreen)
self:setFonts()
end
end
elseif self.menu_index == 4 then
if self.resolution_option ~= self.resolution_index then
self.resolution_index = self.resolution_option
love.graphics.setMode(resolutions[self.resolution_index].width,
resolutions[self.resolution_index].height, self.fullscreen)
self:setFonts()
end
end
end
end
function Menu:joystick_input(dt, controller)
if self.joystick_timer < 0 then
if controller.Axes.LeftY > 0.75 then
if self.menu_index < 4 then
self.menu_index = self.menu_index + 1
self.joystick_timer = self.joystick_delay
local menuSelect = loadSound("menuSelect")
love.audio.play(menuSelect)
end
elseif controller.Axes.LeftY < -0.75 then
if self.menu_index > 1 then
self.menu_index = self.menu_index - 1
local menuSelect = loadSound("menuSelect")
love.audio.play(menuSelect)
self.joystick_timer = self.joystick_delay
end
end
if self.menu_index == 2 then
if controller.Axes.LeftX > 0.75 then
if self.scorelimit < 99 then
self.scorelimit = self.scorelimit + 2
self.joystick_timer = self.joystick_delay
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
elseif controller.Axes.LeftX < -0.75 then
if self.scorelimit > 1 then
self.scorelimit = self.scorelimit - 2
self.joystick_timer = self.joystick_delay
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
end
end
if self.menu_index == 3 then
if controller.Axes.LeftX > 0.75 then
self.fullscreen_option = not self.fullscreen_option
self.joystick_timer = self.joystick_delay
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
elseif controller.Axes.LeftX < -0.75 then
self.fullscreen_option = not self.fullscreen_option
self.joystick_timer = self.joystick_delay
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
else
if self.fullscreen_option ~= self.fullscreen then
self.fullscreen_option = self.fullscreen
end
end
if self.menu_index == 4 then
if controller.Axes.LeftX > 0.75 then
if self.resolution_option > 1 then
self.resolution_option = self.resolution_option - 1
self.joystick_timer = self.joystick_delay
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
elseif controller.Axes.LeftX < -0.75 then
if self.resolution_option < #resolutions then
self.resolution_option = self.resolution_option + 1
self.joystick_timer = self.joystick_delay
local menuOption = loadSound("menuOption")
love.audio.play(menuOption)
end
end
else
if self.resolution_option ~= self.resolution_index then
self.resolution_option = self.resolution_index
end
end
else
self.joystick_timer = self.joystick_timer - dt
end
if controller.Buttons.A or controller.Buttons.RB then
if self.menu_index == 1 then
self.active = false
if self.start ~= nil then
love.audio.stop( self.start)
end
self.start = loadSound("start")
love.audio.play( self.start)
self.startCheer = loadSound("cheering")
love.audio.play( self.startCheer)
Main:load()
menu.win = false
self.joystick_timer = self.joystick_delay
elseif self.menu_index == 3 then
if self.fullscreen_option then
if not self.fullscreen then
self.fullscreen = true
self.resolution_index = 1
love.graphics.setMode(resolutions[self.resolution_index].width, resolutions[self.resolution_index].height, self.fullscreen)
self:setFonts()
self.joystick_timer = self.joystick_delay
end
elseif not self.fullscreen_option then
if self.fullscreen then
self.fullscreen = false
self.resolution_index = math.floor(#resolutions/2)
love.graphics.setMode(resolutions[self.resolution_index].width, resolutions[self.resolution_index].height, self.fullscreen)
self:setFonts()
self.joystick_timer = self.joystick_delay
end
end
elseif self.menu_index == 4 then
if self.resolution_option ~= self.resolution_index then
self.resolution_index = self.resolution_option
love.graphics.setMode(resolutions[self.resolution_index].width, resolutions[self.resolution_index].height, self.fullscreen)
self:setFonts()
self.joystick_timer = self.joystick_delay
end
end
end
end
function Menu:draw_title()
love.graphics.setFont(self.titleFont)
text = "SOKA"
textWidth = self.titleFont:getWidth(text)
love.graphics.setColor(255, 255, 255, 200)
love.graphics.print(text, 50 * scalefactor.x - textWidth/2, 5 * scalefactor.y)
love.graphics.rectangle('fill', 50 * scalefactor.x - textWidth/2 + 13.5 * scalefactor.x,
7 * scalefactor.y, 2.5 * scalefactor.x, 2.5 * scalefactor.y)
love.graphics.rectangle('fill', 50 * scalefactor.x - textWidth/2 + 18 * scalefactor.x,
7 * scalefactor.y, 2.5 * scalefactor.x, 2.5 * scalefactor.y)
end
function Menu:draw_menu()
txtwidth = {}
love.graphics.setFont(self.menuFont)
text = "PLAY"
txtwidth[1] = self.menuFont:getWidth(text)
love.graphics.setColor(255, 255, 255, 200)
love.graphics.print(text, 50 * scalefactor.x - txtwidth[1]/2, 40 * scalefactor.y)
text = "SCORE LIMIT : " .. self.scorelimit
txtwidth[2] = self.menuFont:getWidth(text)
love.graphics.setColor(255, 255, 255, 200)
love.graphics.print(text, 50 * scalefactor.x - txtwidth[2]/2, 50 * scalefactor.y)
text = "FULLSCREEN"
if self.fullscreen_option then
text = text .. " : YES"
else
text = text .. " : NO"
end
txtwidth[3] = self.menuFont:getWidth(text)
love.graphics.setColor(255, 255, 255, 200)
love.graphics.print(text, 50 * scalefactor.x - txtwidth[3]/2, 60 * scalefactor.y)
--if not self.fullscreen then
text = "SCREEN RESOLUTION"
text = text .. " : " .. resolutions[self.resolution_option].width .. "x" .. resolutions[self.resolution_option].height
txtwidth[4] = self.menuFont:getWidth(text)
love.graphics.setColor(255, 255, 255, 200)
love.graphics.print(text, 50 * scalefactor.x - txtwidth[4]/2, 70 * scalefactor.y)
--end
local pos = { }
if self.menu_index == 1 then
pos.x = 50 * scalefactor.x + txtwidth[1]/1.3
pos.y = 40 * scalefactor.y + scalefactor.x * 1.5
elseif self.menu_index == 2 then
pos.x = 50 * scalefactor.x + txtwidth[2]/1.75
pos.y = 50 * scalefactor.y + scalefactor.x * 1.5
elseif self.menu_index == 3 then
pos.x = 50 * scalefactor.x + txtwidth[3]/1.75
pos.y = 60 * scalefactor.y + scalefactor.x * 1.5
elseif self.menu_index == 4 then
pos.x = 50 * scalefactor.x + txtwidth[4]/1.85
pos.y = 70 * scalefactor.y + scalefactor.x * 1.5
end
love.graphics.setColor(0, 0, 0, 100)
love.graphics.circle("fill", pos.x + (1 * scalefactor.x)/4,
pos.y + (1 * scalefactor.x)/4 , 1 * scalefactor.x)
love.graphics.setColor(240, 240, 240, 255)
love.graphics.circle("fill", pos.x, pos.y, 1 * scalefactor.x)
end
function Menu:draw_players()
w = 3 * scalefactor.x
h = 3 * scalefactor.x
pos = {x = 45 * scalefactor.x, y = 85 * scalefactor.y}
if love.joystick.isOpen( 1 ) then
love.graphics.setColor(0, 0, 0, 100)
love.graphics.rectangle("fill", pos.x - w/2, pos.y - h/4, w, h)
love.graphics.setColor(51, 153, 255, 255)
love.graphics.rectangle("fill", pos.x-w/2, pos.y-h/2, w, h)
end
pos = {x = 55 * scalefactor.x, y = 85 * scalefactor.y}
if love.joystick.isOpen( 2 ) then
love.graphics.setColor(0, 0, 0, 100)
love.graphics.rectangle("fill", pos.x - w/2, pos.y - h/4, w, h)
love.graphics.setColor(255, 102, 102, 255)
love.graphics.rectangle("fill", pos.x-w/2, pos.y-h/2, w, h)
end
end
function Menu:create_particles()
local speed = 2
for i=1, 1 do
table.insert(self.particles, Particle:new(100 * scalefactor.x, math.random() * 100 * scalefactor.y, -math.random() * 10, math.random() * 10 - 5, math.random()* speed, math.random()*self.particle_min_size,math.random()*self.particle_min_size, 3))
--Roof
table.insert(self.particles, Particle:new( math.random() * 100 * scalefactor.x, 100 * scalefactor.y, math.random() * 10 - 5, -math.random() * 10, math.random()* speed, math.random()*self.particle_min_size,math.random()*self.particle_min_size, 3))
--Base
table.insert(self.particles, Particle:new( math.random() * 100 * scalefactor.x, 0, math.random() * 10 - 5, math.random() * 10, math.random()* speed, math.random()*self.particle_min_size,math.random()*self.particle_min_size, 3))
end
for i=1, 1 do
table.insert(self.particles, Particle:new(0, math.random() * 100 * scalefactor.y, math.random() * 10, math.random() * 10 - 5, math.random()* speed, math.random()*2,math.random()*2, 3))
end
for i=1, 1 do
table.insert(self.particles, Particle:new(0, math.random() * 100 * scalefactor.y, math.random() * 10, math.random() * 10 - 5, math.random()* speed, math.random()*self.particle_min_size,math.random()*self.particle_min_size, 32))
--Roof
table.insert(self.particles, Particle:new( math.random() * 100 * scalefactor.x, 100 * scalefactor.y, math.random() * 10 - 5, -math.random() * 10, math.random()* speed, math.random()*self.particle_min_size,math.random()*self.particle_min_size, 3))
--Base
table.insert(self.particles, Particle:new( math.random() * 100 * scalefactor.x, 0, math.random() * 10 - 5, math.random() * 10, math.random()* speed, math.random()*self.particle_min_size,math.random()*self.particle_min_size, 3))
end
for i=1, 1 do
table.insert(self.particles, Particle:new(100 * scalefactor.x, math.random() * 100 * scalefactor.y, -math.random() * 10, math.random() * 10 - 5, math.random()* speed, math.random()*2,math.random()*2, 3))
end
end | gpl-2.0 |
dickeyf/darkstar | scripts/zones/Al_Zahbi/npcs/Najaaj.lua | 13 | 1034 | -----------------------------------
-- Area: Al Zahbi
-- NPC: Najaaj
-- Type: Standard NPC
-- @zone: 48
-- @pos 61.563 -1 36.264
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x00f1);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
| gpl-3.0 |
Turttle/darkstar | scripts/zones/Bastok_Markets/npcs/Malene.lua | 29 | 2371 | -----------------------------------
-- Area: Bastok Markets
-- NPC: Malene
-- Type: Quest NPC
-- @zone: 235
-- @pos -173 -4 64
-----------------------------------
package.loaded["scripts/zones/Bastok_Markets/TextIDs"] = nil;
require("scripts/globals/settings");
require("scripts/globals/titles");
require("scripts/globals/quests");
require("scripts/zones/Bastok_Markets/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (trade:hasItemQty(550, 1) and trade:getItemCount() == 1) then -- Quest: The Cold Light of Day - Trade Steam Clock
if (player:getQuestStatus(BASTOK, THE_COLD_LIGHT_OF_DAY) ~= QUEST_AVAILABLE) then
player:startEvent(0x0068);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getQuestStatus(BASTOK, WISH_UPON_A_STAR) == QUEST_ACCEPTED and player:getVar("WishUponAStar_Status") == 1) then -- Quest: Wish Upon a Star
player:startEvent(0x014A);
else -- Quest: The Cold Light of Day
player:startEvent(0x0066);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x0066) then -- Quest: The Cold Light of Day
if (player:getQuestStatus(BASTOK, THE_COLD_LIGHT_OF_DAY) == QUEST_AVAILABLE) then
player:addQuest(BASTOK, THE_COLD_LIGHT_OF_DAY);
end
elseif (csid == 0x0068) then -- Quest: The Cold Light of Day - Traded Steam Clock
player:tradeComplete( );
player:addTitle(CRAB_CRUSHER);
player:addGil(GIL_RATE*500);
player:messageSpecial(GIL_OBTAINED, GIL_RATE*500);
if (TheColdLightofDay == QUEST_ACCEPTED) then
player:addFame(BASTOK, BAS_FAME * 50);
player:completeQuest(BASTOK, THE_COLD_LIGHT_OF_DAY);
else
player:addFame(BASTOK, BAS_FAME * 8);
end
elseif (csid == 0x014A) then -- Quest: Wish Upon a Star
player:setVar("WishUponAStar_Status", 2);
end
end;
| gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c89870349.lua | 5 | 2615 | --M・HERO ブラスト
function c89870349.initial_effect(c)
c:EnableReviveLimit()
--special summon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(89870349,0))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetTarget(c89870349.atktg)
e2:SetOperation(c89870349.atkop)
c:RegisterEffect(e2)
--to hand
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(89870349,1))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCountLimit(1)
e3:SetCost(c89870349.thcost)
e3:SetTarget(c89870349.thtg)
e3:SetOperation(c89870349.thop)
c:RegisterEffect(e3)
end
function c89870349.atktg(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:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
end
function c89870349.atkop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(tc:GetAttack()/2)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
end
end
function c89870349.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,500) end
Duel.PayLPCost(tp,500)
end
function c89870349.thfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function c89870349.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and c89870349.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c89870349.thfilter,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,c89870349.thfilter,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c89870349.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
| gpl-2.0 |
indigotock/brucey-tools | gui/number_ticker.lua | 1 | 3381 | local number_ticker = {}
function number_ticker:OnLoad()
self.xmlDoc = XmlDoc.CreateFromFile('btools/gui/forms.xml')
end
number_ticker.cEnabledColour = ApolloColor.new('UI_TextHoloBodyHighlight')
number_ticker.cDisabledColour = ApolloColor.new('UI_BtnTextBlueDisabled')
function constructor(self, container, defaults)
if number_ticker.xmlDoc == nil then
number_ticker.xmlDoc = XmlDoc.CreateFromFile('btools/gui/forms.xml')
end
local obj = {}
setmetatable(obj,{__index = number_ticker})
defaults = defaults or {}
obj.sClass = "number_ticker"
obj.nDefaultValue = defaults.nDefaultValue or 1
obj.nIncrementValue = defaults.nIncrementValue or 0.5
obj.sHeaderText = defaults.sHeaderText or "Item"
obj.tData = defaults.tData or {}
obj.cControl = Apollo.LoadForm(obj.xmlDoc, obj.sClass, container, obj)
obj.cControl:SetData(obj)
obj.cHeaderBox = obj.cControl:FindChild("ItemHeader")
obj.cAddBtn = obj.cControl:FindChild("AddBtn")
obj.cSubtractBtn = obj.cControl:FindChild("SubtractBtn")
obj.cEditBox = obj.cControl:FindChild("EditBox")
obj.fOnChangeValue = defaults.fOnChangeValue or function(ticker, newVal) end
if defaults.nWidth then
local l,t,r,b = obj.cControl:GetAnchorPoints()
obj.cControl:SetAnchorPoints(l,t,0,b)
l,t,r,b = obj.cControl:GetAnchorOffsets()
obj.cControl:SetAnchorOffsets(l,t,defaults.nWidth,b)
end
if defaults.nDivide then
local l,t,r,b = obj.cControl:FindChild("ItemHeader"):GetAnchorPoints()
obj.cControl:FindChild("ItemHeader"):SetAnchorPoints(l,t,defaults.nDivide,b)
local l,t,r,b = obj.cControl:FindChild("MainContainer"):GetAnchorPoints()
obj.cControl:FindChild("MainContainer"):SetAnchorPoints(defaults.nDivide,t,r,b)
end
obj.cAddBtn:AddEventHandler("ButtonSignal","event_add",obj)
obj.cSubtractBtn:AddEventHandler("ButtonSignal","event_subtract",obj)
obj.cEditBox:AddEventHandler("EditBoxChanged","event_type",obj)
obj.cHeaderBox:SetText(obj.sHeaderText)
obj.nPreviousValue = obj.nDefaultValue
obj.cEditBox:SetText(tostring(obj.nDefaultValue or obj.nPreviousValue))
return obj
end
function number_ticker:set_enabled(bEnabled)
self.cAddBtn:Enable(bEnabled)
self.cEditBox:Enable(bEnabled)
self.cSubtractBtn:Enable(bEnabled)
if bEnabled then
self.cEditBox:SetTextColor(self.cEnabledColour)
else
self.cEditBox:SetTextColor(self.cDisabledColour)
end
end
function number_ticker:event_add(cHandler, cControl, nMouseBtn)
self:set_value(self:get_value() + self.nIncrementValue)
end
function number_ticker:event_subtract(cHandler, cControl, nMouseBtn)
self:set_value(self:get_value() - self.nIncrementValue)
end
function number_ticker:event_type( cHandler, cControl, sText )
if tonumber(sText) then
self.nPreviousValue = tonumber(self.cEditBox:GetText())
self.fOnChangeValue(self, tonumber(sText))
elseif sText == "" then
self:set_value(0)
else
self:set_value(self.nPreviousValue)
end
end
function number_ticker:get_value()
return tonumber(self.cEditBox:GetText()) or self.nDefaultValue
end
function number_ticker:set_value( nValue )
self.nPreviousValue = nValue
self.cEditBox:SetText(tostring(nValue or self.nPreviousValue))
self.fOnChangeValue(self, nValue)
end
setmetatable(number_ticker,{__call=constructor})
Apollo.RegisterPackage(number_ticker,'indigotock.btools.gui.number_ticker',2,{})
| mit |
SalvationDevelopment/Salvation-Scripts-TCG | c38528901.lua | 6 | 1810 | --氷結界の決起隊
function c38528901.initial_effect(c)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(38528901,0))
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c38528901.cost)
e1:SetTarget(c38528901.target)
e1:SetOperation(c38528901.operation)
c:RegisterEffect(e1)
end
function c38528901.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c38528901.desfilter(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER)
end
function c38528901.sfilter(c)
return c:IsSetCard(0x2f) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c38528901.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c38528901.desfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c38528901.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler())
and Duel.IsExistingMatchingCard(c38528901.sfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c38528901.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c38528901.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.Destroy(tc,REASON_EFFECT)~=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c38528901.sfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
end
| gpl-2.0 |
dickeyf/darkstar | scripts/globals/items/coeurl_sub.lua | 18 | 1832 | -----------------------------------------
-- ID: 5166
-- Item: coeurl_sub
-- Food Effect: 30Min, All Races
-----------------------------------------
-- Magic 10
-- Strength 5
-- Agility 1
-- Intelligence -2
-- Health Regen While Healing 1
-- Attack % 20
-- Attack Cap 75
-- Ranged ATT % 20
-- Ranged ATT Cap 75
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,1800,5166);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_MP, 10);
target:addMod(MOD_STR, 5);
target:addMod(MOD_AGI, 1);
target:addMod(MOD_INT, -2);
target:addMod(MOD_HPHEAL, 1);
target:addMod(MOD_FOOD_ATTP, 20);
target:addMod(MOD_FOOD_ATT_CAP, 75);
target:addMod(MOD_FOOD_RATTP, 20);
target:addMod(MOD_FOOD_RATT_CAP, 75);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_MP, 10);
target:delMod(MOD_STR, 5);
target:delMod(MOD_AGI, 1);
target:delMod(MOD_INT, -2);
target:delMod(MOD_HPHEAL, 1);
target:delMod(MOD_FOOD_ATTP, 20);
target:delMod(MOD_FOOD_ATT_CAP, 75);
target:delMod(MOD_FOOD_RATTP, 20);
target:delMod(MOD_FOOD_RATT_CAP, 75);
end;
| gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c36378044.lua | 2 | 2217 | --ラッキーパンチ
function c36378044.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c36378044.atktg1)
e1:SetOperation(c36378044.atkop)
c:RegisterEffect(e1)
--coin
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(36378044,0))
e2:SetCategory(CATEGORY_DRAW+CATEGORY_DESTROY+CATEGORY_COIN)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_SZONE)
e2:SetLabel(1)
e2:SetCondition(c36378044.atkcon)
e2:SetTarget(c36378044.atktg2)
e2:SetOperation(c36378044.atkop)
c:RegisterEffect(e2)
--life lost
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(c36378044.descon)
e3:SetOperation(c36378044.desop)
c:RegisterEffect(e3)
end
function c36378044.atkcon(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer()
end
function c36378044.atktg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetLabel(0)
if Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and tp~=Duel.GetTurnPlayer()
and Duel.SelectYesNo(tp,aux.Stringid(36378044,1)) then
e:SetLabel(1)
Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,3)
e:GetHandler():RegisterFlagEffect(36378044,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
else e:SetLabel(0) end
end
function c36378044.atktg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(36378044)==0 end
Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,3)
e:GetHandler():RegisterFlagEffect(36378044,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c36378044.atkop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==0 or not e:GetHandler():IsRelateToEffect(e) then return end
local r1,r2,r3=Duel.TossCoin(tp,3)
if r1+r2+r3==3 then
Duel.Draw(tp,3,REASON_EFFECT)
elseif r1+r2+r3==0 then
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
end
function c36378044.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP)
end
function c36378044.desop(e,tp,eg,ep,ev,re,r,rp)
local lp=Duel.GetLP(tp)
Duel.SetLP(tp,lp-6000)
end
| gpl-2.0 |
dickeyf/darkstar | scripts/globals/items/moogle_pie.lua | 18 | 1701 | -----------------------------------------
-- ID: 5561
-- Item: Moogle Pie
-- Food Effect: 3 Hrs, All Races
-----------------------------------------
-- HP 20
-- MP 20
-- Strength 1
-- Dexterity 1
-- Vitality 1
-- Agility 1
-- Intelligence 1
-- Mind 1
-- Charisma 1
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,10800,5561);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_HP, 20);
target:addMod(MOD_MP, 20);
target:addMod(MOD_STR,1);
target:addMod(MOD_DEX, 1);
target:addMod(MOD_VIT,1);
target:addMod(MOD_AGI,1);
target:addMod(MOD_INT, 1);
target:addMod(MOD_MND,1);
target:addMod(MOD_CHR, 1);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_HP, 20);
target:delMod(MOD_MP, 20);
target:delMod(MOD_STR,1);
target:delMod(MOD_DEX, 1);
target:delMod(MOD_VIT,1);
target:delMod(MOD_AGI,1);
target:delMod(MOD_INT, 1);
target:delMod(MOD_MND,1);
target:delMod(MOD_CHR, 1);
end;
| gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c110000106.lua | 2 | 2311 | --Over Boost
function c110000106.initial_effect(c)
--direct attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DIRECT_ATTACK)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(c110000106.datg)
c:RegisterEffect(e1)
--Restrict Attack
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetCondition(c110000106.racon)
e2:SetOperation(c110000106.raop)
c:RegisterEffect(e2)
--Attack Redirection
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetCondition(c110000106.arcon)
e3:SetTarget(c110000106.artar)
e3:SetOperation(c110000106.arop)
c:RegisterEffect(e3)
end
function c110000106.datg(e,c)
return c:IsSetCard(0x3A2E)
end
function c110000106.afilter(c)
return c:IsSetCard(0x3A2E) and c:IsFaceup()
end
function c110000106.atkfilter(e,c)
return c:IsSetCard(0x3A2E)
end
function c110000106.arcon(e,tp,eg,ep,ev,re,r,rp)
return r~=REASON_REPLACE and Duel.GetAttackTarget()==e:GetHandler()
and Duel.GetAttacker():IsControler(1-tp) and e:GetHandler():GetBattlePosition()~=POS_FACEDOWN_DEFENSE
end
function c110000106.artar(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) end
if chk==0 then return Duel.IsExistingMatchingCard(c110000106.afilter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c110000106.afilter,tp,LOCATION_MZONE,0,1,1,Duel.GetAttackTarget())
end
function c110000106.arop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.ChangeAttackTarget(tc)
end
end
function c110000106.racon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler()==Duel.GetAttacker()
end
function c110000106.raop(e,tp,eg,ep,ev,re,r,rp)
local j=e:GetHandler()
local e9=Effect.CreateEffect(e:GetHandler())
e9:SetType(EFFECT_TYPE_FIELD)
e9:SetRange(LOCATION_MZONE)
e9:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
e9:SetTargetRange(LOCATION_MZONE,0)
e9:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e9:SetTarget(c110000106.atkfilter)
j:RegisterEffect(e9)
end | gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c70307656.lua | 5 | 1342 | --グラッジ
function c70307656.initial_effect(c)
--direct attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DIRECT_ATTACK)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_BATTLE_DAMAGE)
e2:SetOperation(c70307656.regop)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(70307656,0))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCountLimit(1)
e3:SetCondition(c70307656.atkcon)
e3:SetOperation(c70307656.atkop)
c:RegisterEffect(e3)
end
function c70307656.regop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(70307656,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,0,1)
end
function c70307656.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp and e:GetHandler():GetFlagEffect(70307656)~=0
end
function c70307656.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetValue(1000)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
end
end
| gpl-2.0 |
dickeyf/darkstar | scripts/globals/items/hellfire_sword.lua | 41 | 1073 | -----------------------------------------
-- ID: 16928
-- Item: Hellfire Sword
-- Additional Effect: Fire Damage
-----------------------------------------
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------
-- onAdditionalEffect Action
-----------------------------------
function onAdditionalEffect(player,target,damage)
local chance = 10;
if (math.random(0,99) >= chance) then
return 0,0,0;
else
local dmg = math.random(3,10);
local params = {};
params.bonusmab = 0;
params.includemab = false;
dmg = addBonusesAbility(player, ELE_FIRE, target, dmg, params);
dmg = dmg * applyResistanceAddEffect(player,target,ELE_FIRE,0);
dmg = adjustForTarget(target,dmg,ELE_FIRE);
dmg = finalMagicNonSpellAdjustments(player,target,ELE_FIRE,dmg);
local message = MSGBASIC_ADD_EFFECT_DMG;
if (dmg < 0) then
message = MSGBASIC_ADD_EFFECT_HEAL;
end
return SUBEFFECT_FIRE_DAMAGE,message,dmg;
end
end; | gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c49823708.lua | 6 | 3572 | --破壊剣士の伴竜
function c49823708.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c49823708.target)
e1:SetOperation(c49823708.operation)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(49823708,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,49823708)
e2:SetCost(c49823708.spcost)
e2:SetTarget(c49823708.sptg)
e2:SetOperation(c49823708.spop)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(49823708,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1,49823708)
e3:SetCondition(c49823708.spcon2)
e3:SetCost(c49823708.spcost2)
e3:SetTarget(c49823708.sptg2)
e3:SetOperation(c49823708.spop2)
c:RegisterEffect(e3)
end
function c49823708.filter(c)
return c:IsSetCard(0xd6) and not c:IsCode(49823708) and c:IsAbleToHand()
end
function c49823708.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c49823708.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c49823708.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c49823708.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c49823708.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c49823708.spfilter(c,e,tp)
return c:IsCode(78193831) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c49823708.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c49823708.spfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND)
end
function c49823708.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,aux.NecroValleyFilter(c49823708.spfilter),tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c49823708.cfilter(c)
return c:IsFaceup() and c:IsCode(78193831)
end
function c49823708.spcon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c49823708.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c49823708.costfilter(c)
return c:IsSetCard(0xd6) and c:IsAbleToGraveAsCost()
end
function c49823708.spcost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c49823708.costfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,c49823708.costfilter,1,1,REASON_COST)
end
function c49823708.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c49823708.spop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
mohammadclash/STAR | plugins/img_google.lua | 660 | 3196 | do
local mime = require("mime")
local google_config = load_from_file('data/google.lua')
local cache = {}
--[[
local function send_request(url)
local t = {}
local options = {
url = url,
sink = ltn12.sink.table(t),
method = "GET"
}
local a, code, headers, status = http.request(options)
return table.concat(t), code, headers, status
end]]--
local function get_google_data(text)
local url = "http://ajax.googleapis.com/ajax/services/search/images?"
url = url.."v=1.0&rsz=5"
url = url.."&q="..URL.escape(text)
url = url.."&imgsz=small|medium|large"
if google_config.api_keys then
local i = math.random(#google_config.api_keys)
local api_key = google_config.api_keys[i]
if api_key then
url = url.."&key="..api_key
end
end
local res, code = http.request(url)
if code ~= 200 then
print("HTTP Error code:", code)
return nil
end
local google = json:decode(res)
return google
end
-- Returns only the useful google data to save on cache
local function simple_google_table(google)
local new_table = {}
new_table.responseData = {}
new_table.responseDetails = google.responseDetails
new_table.responseStatus = google.responseStatus
new_table.responseData.results = {}
local results = google.responseData.results
for k,result in pairs(results) do
new_table.responseData.results[k] = {}
new_table.responseData.results[k].unescapedUrl = result.unescapedUrl
new_table.responseData.results[k].url = result.url
end
return new_table
end
local function save_to_cache(query, data)
-- Saves result on cache
if string.len(query) <= 7 then
local text_b64 = mime.b64(query)
if not cache[text_b64] then
local simple_google = simple_google_table(data)
cache[text_b64] = simple_google
end
end
end
local function process_google_data(google, receiver, query)
if google.responseStatus == 403 then
local text = 'ERROR: Reached maximum searches per day'
send_msg(receiver, text, ok_cb, false)
elseif google.responseStatus == 200 then
local data = google.responseData
if not data or not data.results or #data.results == 0 then
local text = 'Image not found.'
send_msg(receiver, text, ok_cb, false)
return false
end
-- Random image from table
local i = math.random(#data.results)
local url = data.results[i].unescapedUrl or data.results[i].url
local old_timeout = http.TIMEOUT or 10
http.TIMEOUT = 5
send_photo_from_url(receiver, url)
http.TIMEOUT = old_timeout
save_to_cache(query, google)
else
local text = 'ERROR!'
send_msg(receiver, text, ok_cb, false)
end
end
function run(msg, matches)
local receiver = get_receiver(msg)
local text = matches[1]
local text_b64 = mime.b64(text)
local cached = cache[text_b64]
if cached then
process_google_data(cached, receiver, text)
else
local data = get_google_data(text)
process_google_data(data, receiver, text)
end
end
return {
description = "Search image with Google API and sends it.",
usage = "!img [term]: Random search an image with Google API.",
patterns = {
"^!img (.*)$"
},
run = run
}
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c85359414.lua | 4 | 4191 | --氷岩魔獣
function c85359414.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(85359414,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c85359414.eqtg)
e1:SetOperation(c85359414.eqop)
c:RegisterEffect(e1)
--unequip
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(85359414,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(aux.IsUnionState)
e2:SetTarget(c85359414.sptg)
e2:SetOperation(c85359414.spop)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(85359414,2))
e3:SetCategory(CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_BATTLE_DAMAGE)
e3:SetCondition(c85359414.descon)
e3:SetTarget(c85359414.destg)
e3:SetOperation(c85359414.desop)
c:RegisterEffect(e3)
--destroy sub
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP)
e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e4:SetCode(EFFECT_DESTROY_SUBSTITUTE)
e4:SetCondition(aux.IsUnionState)
e4:SetValue(c85359414.repval)
c:RegisterEffect(e4)
--eqlimit
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_EQUIP_LIMIT)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e5:SetValue(c85359414.eqlimit)
c:RegisterEffect(e5)
end
c85359414.old_union=true
function c85359414.repval(e,re,r,rp)
return bit.band(r,REASON_BATTLE)~=0
end
function c85359414.eqlimit(e,c)
return c:IsCode(59364406)
end
function c85359414.filter(c)
return c:IsFaceup() and c:IsCode(59364406) and c:GetUnionCount()==0
end
function c85359414.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c85359414.filter(chkc) end
if chk==0 then return e:GetHandler():GetFlagEffect(85359414)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c85359414.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c85359414.filter,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
e:GetHandler():RegisterFlagEffect(85359414,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c85359414.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
if not tc:IsRelateToEffect(e) or not c85359414.filter(tc) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
if not Duel.Equip(tp,c,tc,false) then return end
aux.SetUnionState(c)
end
function c85359414.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(85359414)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
e:GetHandler():RegisterFlagEffect(85359414,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c85359414.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_ATTACK)
end
function c85359414.descon(e,tp,eg,ep,ev,re,r,rp)
return aux.IsUnionState(e) and ep~=tp and eg:GetFirst()==e:GetHandler():GetEquipTarget()
end
function c85359414.desfilter(c)
return c:IsFacedown()
end
function c85359414.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_SZONE) and c85359414.desfilter(chkc) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c85359414.desfilter,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c85359414.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsFacedown() and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c23282832.lua | 6 | 1459 | --オーバーリミット
function c23282832.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetCost(c23282832.cost)
e1:SetTarget(c23282832.tg)
e1:SetOperation(c23282832.op)
c:RegisterEffect(e1)
end
function c23282832.filter(c,e,tp,tid)
return c:GetTurnID()==tid and c:IsReason(REASON_BATTLE) and c:IsType(TYPE_NORMAL)
and c:IsAttackBelow(1000) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c23282832.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,500) end
Duel.PayLPCost(tp,500)
end
function c23282832.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c23282832.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp,Duel.GetTurnCount()) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,PLAYER_ALL,LOCATION_GRAVE)
end
function c23282832.op(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then return end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c23282832.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,ft,ft,nil,e,tp,Duel.GetTurnCount())
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
Turttle/darkstar | scripts/zones/Al_Zahbi/npcs/Gidappa.lua | 53 | 2317 | -----------------------------------
-- Area: Al Zahbi
-- NPC: Gidappa
-- Type: Clothcraft Normal/Adv. Image Support
-- @pos 70.228 -7 -54.089 48
-----------------------------------
package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/crafting");
require("scripts/zones/Al_Zahbi/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local guildMember = isGuildMember(player,3);
if (guildMember == 1) then
if (trade:hasItemQty(2184,1) and trade:getItemCount() == 1) then
if (player:hasStatusEffect(EFFECT_CLOTHCRAFT_IMAGERY) == false) then
player:tradeComplete();
player:startEvent(0x00E5,8,0,0,0,188,0,4,0);
else
npc:showText(npc, IMAGE_SUPPORT_ACTIVE);
end
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local guildMember = isGuildMember(player,3);
local SkillLevel = player:getSkillLevel(SKILL_CLOTHCRAFT);
if (guildMember == 1) then
if (player:hasStatusEffect(EFFECT_CLOTHCRAFT_IMAGERY) == false) then
player:startEvent(0x00E4,8,SkillLevel,0,511,188,0,4,2184);
else
player:startEvent(0x00E4,8,SkillLevel,0,511,188,7127,4,2184);
end
else
player:startEvent(0x00E4,0,0,0,0,0,0,4,0); -- Standard Dialogue
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x00E4 and option == 1) then
player:messageSpecial(IMAGE_SUPPORT,0,4,1);
player:addStatusEffect(EFFECT_CLOTHCRAFT_IMAGERY,1,0,120);
elseif (csid == 0x00E5) then
player:messageSpecial(IMAGE_SUPPORT,0,4,0);
player:addStatusEffect(EFFECT_CLOTHCRAFT_IMAGERY,3,0,480);
end
end; | gpl-3.0 |
dickeyf/darkstar | scripts/zones/Al_Zahbi/npcs/Gidappa.lua | 53 | 2317 | -----------------------------------
-- Area: Al Zahbi
-- NPC: Gidappa
-- Type: Clothcraft Normal/Adv. Image Support
-- @pos 70.228 -7 -54.089 48
-----------------------------------
package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/crafting");
require("scripts/zones/Al_Zahbi/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
local guildMember = isGuildMember(player,3);
if (guildMember == 1) then
if (trade:hasItemQty(2184,1) and trade:getItemCount() == 1) then
if (player:hasStatusEffect(EFFECT_CLOTHCRAFT_IMAGERY) == false) then
player:tradeComplete();
player:startEvent(0x00E5,8,0,0,0,188,0,4,0);
else
npc:showText(npc, IMAGE_SUPPORT_ACTIVE);
end
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local guildMember = isGuildMember(player,3);
local SkillLevel = player:getSkillLevel(SKILL_CLOTHCRAFT);
if (guildMember == 1) then
if (player:hasStatusEffect(EFFECT_CLOTHCRAFT_IMAGERY) == false) then
player:startEvent(0x00E4,8,SkillLevel,0,511,188,0,4,2184);
else
player:startEvent(0x00E4,8,SkillLevel,0,511,188,7127,4,2184);
end
else
player:startEvent(0x00E4,0,0,0,0,0,0,4,0); -- Standard Dialogue
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
-- printf("CSID: %u",csid);
-- printf("RESULT: %u",option);
if (csid == 0x00E4 and option == 1) then
player:messageSpecial(IMAGE_SUPPORT,0,4,1);
player:addStatusEffect(EFFECT_CLOTHCRAFT_IMAGERY,1,0,120);
elseif (csid == 0x00E5) then
player:messageSpecial(IMAGE_SUPPORT,0,4,0);
player:addStatusEffect(EFFECT_CLOTHCRAFT_IMAGERY,3,0,480);
end
end; | gpl-3.0 |
dickeyf/darkstar | scripts/zones/Behemoths_Dominion/npcs/Cermet_Headstone.lua | 13 | 3090 | -----------------------------------
-- Area: Behemoth's Dominion
-- NPC: Cermet Headstone
-- Involved in Mission: ZM5 Headstone Pilgrimage (Lightning Headstone)
-- @pos -74 -4 -87 127
-----------------------------------
package.loaded["scripts/zones/Behemoths_Dominion/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/globals/titles");
require("scripts/globals/missions");
require("scripts/zones/Behemoths_Dominion/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getCurrentMission(ZILART) == HEADSTONE_PILGRIMAGE) then
-- if requirements are met and 15 mins have passed since mobs were last defeated, spawn them
if (player:hasKeyItem(LIGHTNING_FRAGMENT) == false and GetServerVariable("[ZM4]Lightning_Headstone_Active") < os.time()) then
player:startEvent(0x00C8,LIGHTNING_FRAGMENT);
-- if 15 min window is open and requirements are met, recieve key item
elseif (player:hasKeyItem(LIGHTNING_FRAGMENT) == false and GetServerVariable("[ZM4]Lightning_Headstone_Active") > os.time()) then
player:addKeyItem(LIGHTNING_FRAGMENT);
-- Check and see if all fragments have been found (no need to check wind and dark frag)
if (player:hasKeyItem(ICE_FRAGMENT) and player:hasKeyItem(EARTH_FRAGMENT) and player:hasKeyItem(WATER_FRAGMENT) and
player:hasKeyItem(FIRE_FRAGMENT) and player:hasKeyItem(WIND_FRAGMENT) and player:hasKeyItem(LIGHT_FRAGMENT)) then
player:messageSpecial(FOUND_ALL_FRAGS,LIGHTNING_FRAGMENT);
player:addTitle(BEARER_OF_THE_EIGHT_PRAYERS);
player:completeMission(ZILART,HEADSTONE_PILGRIMAGE);
player:addMission(ZILART,THROUGH_THE_QUICKSAND_CAVES);
else
player:messageSpecial(KEYITEM_OBTAINED,LIGHTNING_FRAGMENT);
end
else
player:messageSpecial(ALREADY_OBTAINED_FRAG,LIGHTNING_FRAGMENT);
end
elseif (player:hasCompletedMission(ZILART,HEADSTONE_PILGRIMAGE)) then
player:messageSpecial(ZILART_MONUMENT);
else
player:messageSpecial(CANNOT_REMOVE_FRAG);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x00C8 and option == 1) then
SpawnMob(17297450,300):updateClaim(player); -- Legendary Weapon
SpawnMob(17297449,300):updateClaim(player); -- Ancient Weapon
SetServerVariable("[ZM4]Lightning_Headstone_Active",0);
end
end; | gpl-3.0 |
Turttle/darkstar | scripts/zones/Selbina/npcs/Abelard.lua | 17 | 7136 | -----------------------------------
-- Area: Selbina
-- NPC: Abelard
-- An Explorer's Footsteps
-- @pos -52 -11 -13 248
-- This quest was changed to require a minimum amount of fame to combat RMTs POS-Hacking around to
-- quickly earn gil. However, as this is not a legitimate concern on private servers players may
-- complete this quest even with no fame.
-----------------------------------
package.loaded["scripts/zones/Selbina/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/Selbina/TextIDs");
require("scripts/globals/quests");
require("scripts/globals/keyitems");
require("scripts/globals/settings");
ZoneID =
{
0x00001,800, -- West Ronfaure
0x00002,800, -- East Ronfaure
0x00004,1000, -- La Theine Plateau
0x00008,1000, -- Valkurm Dunes
0x00010,1000, -- Jugner Forest
0x00020,3000, -- North Gustaberg
0x00040,800, -- South Gustaberg
0x00080,1000, -- Konschtat Highlands
0x00100,1000, -- Pashhow Marshlands
0x00200,3000, -- Rolanberry Fields
0x00400,800, -- West Sarutabaruta
0x00800,800, -- East Sarutabaruta
0x01000,1000, -- Tahrongi Canyon
0x02000,1000, -- Buburimu Peninsula
0x04000,1000, -- Meriphataud Mountains
0x08000,10000, -- Sauromugue Champaign
0x10000,10000 -- Batallia Downs
};
-----------------------------------
-- onTrade
-----------------------------------
function onTrade(player,npc,trade)
local explorer = player:getQuestStatus(OTHER_AREAS,EN_EXPLORER_S_FOOTSTEPS);
-- AN EXPLORERS FOOTSTEPS QUEST --
if (explorer == QUEST_ACCEPTED) then
local clay = trade:hasItemQty(570,1);
local count = trade:getItemCount();
if (count == 1 and clay) then
local tablets = player:getVar("anExplorer-ClayTablets");
local currtab = player:getVar("anExplorer-CurrentTablet");
if (currtab ~= 0 and (tablets % (2*currtab)) < currtab) then -- new tablet
for zone = 1, #ZoneID, 2 do
if (tablets % (2*ZoneID[zone]) < ZoneID[zone]) then
if ((tablets + currtab) == 0x1ffff) then
player:startEvent(0x002f); -- end
break;
end
if (ZoneID[zone] == currtab) then
player:startEvent(0x0029); -- the tablet he asked for
else
player:startEvent(0x002e); -- not the one he asked for
end
player:setVar("anExplorer-ClayTablets", tablets + currtab);
break;
end
end
end
end
end
end;
-----------------------------------
-- onTrigger
-----------------------------------
function onTrigger(player,npc)
local explorer = player:getQuestStatus(OTHER_AREAS,EN_EXPLORER_S_FOOTSTEPS);
local keyitem = player:hasKeyItem(TORN_OUT_PAGES);
local blood = player:getQuestStatus(SANDORIA,SIGNED_IN_BLOOD);
local SignedBldProg = player:getVar("SIGNED_IN_BLOOD_Prog");
-- SIGNED IN BLOOD QUEST -- (WILL ONLY ACTIVATE IF EXPLORERS
-- FOOTSTEPS IS NOT ACTIVE OR IF IT IS COMPLETED)
if (blood == QUEST_ACCEPTED and keyitem == true and explorer ~= QUEST_ACCEPTED and SignedBldProg == 2) then
player:startEvent(0x0452);
elseif (blood == QUEST_ACCEPTED and SignedBldProg == 1 and explorer ~= QUEST_ACCEPTED) then
player:startEvent(0x0450);
elseif (blood == QUEST_ACCEPTED and SignedBldProg == 2 and explorer ~= QUEST_ACCEPTED) then
player:startEvent(0x0451);
elseif (blood == QUEST_ACCEPTED and SignedBldProg == 3) then
player:startEvent(0x0030); -- after quest
-- AN EXPLORERS FOOTSTEP QUEST --
elseif (explorer == QUEST_AVAILABLE and math.floor((player:getFameLevel(SANDORIA) + player:getFameLevel(BASTOK)) / 2) >= 1) then
player:startEvent(0x0028);
elseif (explorer == QUEST_ACCEPTED) then
local tab = player:hasItem(570);
local clay = player:hasItem(571);
if (clay == false and tab == false) then
local currtab = player:getVar("anExplorer-CurrentTablet");
if (currtab == -1) then
player:startEvent(0x002a);
else
player:startEvent(0x002c);
player:setVar("anExplorer-CurrentTablet",0);
end
else
local tablets = player:getVar("anExplorer-ClayTablets");
for zone = 1, #ZoneID, 2 do
if (tablets % (2*ZoneID[zone]) < ZoneID[zone]) then
if (zone < 20) then
player:startEvent(0x002b,math.floor(zone/2));
else
player:startEvent(0x0031,math.floor(zone/2)-10);
end
break;
end
end
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x0452) then
player:setVar("SIGNED_IN_BLOOD_Prog",3);
elseif (csid == 0x0028 and option ~= 0) then
if (player:getFreeSlotsCount() > 0) then
player:addQuest(OTHER_AREAS,EN_EXPLORER_S_FOOTSTEPS);
player:addItem(571);
player:messageSpecial(ITEM_OBTAINED,571);
player:setVar("anExplorer-ClayTablets",0);
else
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,571);
end
elseif (csid == 0x002a and option == 100) then
if (player:getFreeSlotsCount() > 0) then
player:addItem(571);
player:messageSpecial(ITEM_OBTAINED,571);
player:setVar("anExplorer-CurrentTablet",0);
else
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,571);
end
elseif (csid == 0x002c) then
if (player:getFreeSlotsCount() > 0) then
player:addItem(571);
player:messageSpecial(ITEM_OBTAINED,571);
else
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,571);
end
elseif (csid == 0x0029 or csid == 0x002e or csid == 0x002f) then
local currtab = player:getVar("anExplorer-CurrentTablet");
local tablets = player:getVar("anExplorer-ClayTablets");
local keyitem = player:hasKeyItem(MAP_OF_THE_CRAWLERS_NEST);
for zone = 1, #ZoneID, 2 do
if (ZoneID[zone] == currtab) then
player:tradeComplete();
player:addGil(GIL_RATE*ZoneID[zone+1]);
player:messageSpecial(GIL_OBTAINED,GIL_RATE*ZoneID[zone+1]);
player:setVar("anExplorer-CurrentTablet",0);
break;
end
end
if (csid == 0x002f) then
player:completeQuest(OTHER_AREAS,EN_EXPLORER_S_FOOTSTEPS);
player:setVar("anExplorer-ClayTablets",0);
end
if (option == 100) then
player:addItem(571);
player:messageSpecial(ITEM_OBTAINED,571);
end
if (option == 110) then
player:setVar("anExplorer-CurrentTablet",-1);
end
if ((tablets % (2*0x7fff)) >= 0x7fff and keyitem == false) then
player:addKeyItem(MAP_OF_THE_CRAWLERS_NEST);
player:messageSpecial(KEYITEM_OBTAINED,MAP_OF_THE_CRAWLERS_NEST);
end
elseif (csid == 0x0450) then
player:setVar("SIGNED_IN_BLOOD_Prog",2);
end
end; | gpl-3.0 |
Turttle/darkstar | scripts/zones/Caedarva_Mire/npcs/Runic_Portal.lua | 17 | 2782 | -----------------------------------
-- Area: Caedarva Mire
-- NPC: Runic Portal
-- Caedarva Mire Teleporter Back to Aht Urhgan Whitegate
-- @pos -264 -6 -28 79 (Dvucca)
-- @pos 524 -28 -503 79 (Azouph)
-----------------------------------
package.loaded["scripts/zones/Caedarva_Mire/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/besieged");
require("scripts/globals/teleports");
require("scripts/globals/missions");
require("scripts/zones/Caedarva_Mire/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local X = player:getXPos();
local Z = player:getZPos();
if ((X < -258.512 and X > -270.512) and (Z < -22.285 and Z > -34.285)) then -- Dvucca Staging Point
if (player:getCurrentMission(TOAU)== IMMORTAL_SENTRIES) then
if (player:getVar("TOAUM2") == 1) then
player:startEvent(0x007d);
else
player:startEvent(0x0086);
end
elseif (player:getCurrentMission(TOAU) > IMMORTAL_SENTRIES) then
if (hasRunicPortal(player,2) == 1) then
player:startEvent(0x0086);
else
player:startEvent(0x007d);
end
else
player:messageSpecial(RESPONSE);
end
else -- Azouph Staging Point
if (player:getCurrentMission(TOAU)== IMMORTAL_SENTRIES) then
if (player:getVar("TOAUM2") == 1) then
player:startEvent(0x007c);
else
player:startEvent(0x0083);
end
elseif (player:getCurrentMission(TOAU) > IMMORTAL_SENTRIES) then
if (hasRunicPortal(player,1) == 1) then
player:startEvent(0x0083);
else
player:startEvent(0x007c);
end
else
player:messageSpecial(RESPONSE);
end
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x007c and option == 1) then
if (player:getVar("TOAUM2") == 1) then
player:setVar("TOAUM2",2);
end
player:addNationTeleport(AHTURHGAN,2);
toChamberOfPassage(player);
elseif (csid == 0x007d and option == 1) then
if (player:getVar("TOAUM2") == 1) then
player:setVar("TOAUM2",2);
end
player:addNationTeleport(AHTURHGAN,4);
toChamberOfPassage(player);
elseif ((csid == 0x0086 or 0x0083) and option == 1) then
toChamberOfPassage(player);
end
end; | gpl-3.0 |
vincentchen/lede | package/lean/luci-app-wrtbwmon/luasrc/controller/wrtbwmon.lua | 2 | 1696 | module("luci.controller.wrtbwmon", package.seeall)
function index()
entry({"admin", "nlbw", "usage"}, alias("admin", "nlbw", "usage", "details"), _("Usage"), 60)
entry({"admin", "nlbw", "usage", "details"}, template("wrtbwmon"), _("Details"), 10).leaf=true
entry({"admin", "nlbw", "usage", "config"}, cbi("wrtbwmon/config"), _("Configuration"), 20).leaf=true
entry({"admin", "nlbw", "usage", "custom"}, form("wrtbwmon/custom"), _("User file"), 30).leaf=true
entry({"admin", "nlbw", "usage", "check_dependency"}, call("check_dependency")).dependent=true
entry({"admin", "nlbw", "usage", "usage_data"}, call("usage_data")).dependent=true
entry({"admin", "nlbw", "usage", "usage_reset"}, call("usage_reset")).dependent=true
end
function usage_database_path()
local cursor = luci.model.uci.cursor()
if cursor:get("wrtbwmon", "general", "persist") == "1" then
return "/etc/config/usage.db"
else
return "/tmp/usage.db"
end
end
function check_dependency()
local ret = "0"
if require("luci.model.ipkg").installed('iptables') then
ret = "1"
end
luci.http.prepare_content("text/plain")
luci.http.write(ret)
end
function usage_data()
local db = usage_database_path()
local publish_cmd = "wrtbwmon publish " .. db .. " /tmp/usage.htm /etc/config/wrtbwmon.user"
local cmd = "wrtbwmon update " .. db .. " && " .. publish_cmd .. " && cat /tmp/usage.htm"
luci.http.prepare_content("text/html")
luci.http.write(luci.sys.exec(cmd))
end
function usage_reset()
local db = usage_database_path()
local ret = luci.sys.call("wrtbwmon update " .. db .. " && rm " .. db)
luci.http.status(204)
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c74371660.lua | 5 | 2113 | --水精鱗-ガイオアビス
function c74371660.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER),7,2)
c:EnableReviveLimit()
--atklimit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetTarget(aux.TargetBoolFunction(Card.IsLevelAbove,5))
e1:SetCondition(c74371660.dscon)
c:RegisterEffect(e1)
--negate
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(74371660,0))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,0x1c0)
e2:SetCost(c74371660.cost)
e2:SetTarget(c74371660.target)
e2:SetOperation(c74371660.operation)
c:RegisterEffect(e2)
end
function c74371660.dscon(e)
return e:GetHandler():GetOverlayCount()~=0
end
function c74371660.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 c74371660.filter(c,atk)
return aux.disfilter1(c) and c:GetAttack()<atk
end
function c74371660.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c74371660.filter,tp,0,LOCATION_MZONE,1,nil,e:GetHandler():GetAttack()) end
end
function c74371660.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local g=Duel.GetMatchingGroup(c74371660.filter,tp,0,LOCATION_MZONE,nil,c:GetAttack())
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
tc=g:GetNext()
end
end
| gpl-2.0 |
sevenbot/teamseven | plugins/webshot.lua | 919 | 1473 | local helpers = require "OAuth.helpers"
local base = 'https://screenshotmachine.com/'
local url = base .. 'processor.php'
local function get_webshot_url(param)
local response_body = {}
local request_constructor = {
url = url,
method = "GET",
sink = ltn12.sink.table(response_body),
headers = {
referer = base,
dnt = "1",
origin = base,
["User-Agent"] = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36"
},
redirect = false
}
local arguments = {
urlparam = param,
size = "FULL"
}
request_constructor.url = url .. "?" .. helpers.url_encode_arguments(arguments)
local ok, response_code, response_headers, response_status_line = https.request(request_constructor)
if not ok or response_code ~= 200 then
return nil
end
local response = table.concat(response_body)
return string.match(response, "href='(.-)'")
end
local function run(msg, matches)
local find = get_webshot_url(matches[1])
if find then
local imgurl = base .. find
local receiver = get_receiver(msg)
send_photo_from_url(receiver, imgurl)
end
end
return {
description = "Send an screenshot of a website.",
usage = {
"!webshot [url]: Take an screenshot of the web and send it back to you."
},
patterns = {
"^!webshot (https?://[%w-_%.%?%.:/%+=&]+)$",
},
run = run
}
| gpl-2.0 |
fgenesis/Aquaria_experimental | game_scripts/scripts/entities/cc_kid.lua | 6 | 2039 | -- Copyright (C) 2007, 2010 - Bit-Blot
--
-- This file is part of Aquaria.
--
-- Aquaria is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; either version 2
-- of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
-- See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
if not v then v = {} end
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
-- throw rocks
v.n = 0
function init(me)
setupEntity(me)
entity_initSkeletal(me, "CC_Kid")
entity_setState(me, STATE_IDLE)
entity_scale(me, 0.6, 0.6)
entity_setBeautyFlip(me, false)
end
function postInit(me)
v.n = getNaija()
entity_setTarget(me, v.n)
--entity_fh(me)
end
function update(me, dt)
end
function enterState(me)
if entity_isState(me, STATE_IDLE) then
entity_animate(me, "throwing", -1)
--entity_update(me, math.random(100)/100.0)
elseif entity_isState(me, STATE_TRANSFORM) then
entity_setStateTime(me, entity_animate(me, "transform"))
end
end
function exitState(me)
if entity_isState(me, STATE_TRANSFORM) then
local e = createEntity("Scavenger", "", entity_x(me), entity_y(me))
entity_setState(e, STATE_GROW, -1, 1)
entity_alpha(e, 0)
entity_alpha(e, 1, 0.5)
entity_delete(me, 0.5)
end
end
function damage(me, attacker, bone, damageType, dmg)
return false
end
function animationKey(me, key)
end
function hitSurface(me)
end
function songNote(me, note)
end
function songNoteDone(me, note)
end
function song(me, song)
end
function sporesDropped(me, x, y)
end
function activate(me)
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c67964209.lua | 7 | 1524 | --神竜アクアバザル
function c67964209.initial_effect(c)
--todeck
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(67964209,0))
e1:SetCategory(CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c67964209.tdcost)
e1:SetTarget(c67964209.tdtg)
e1:SetOperation(c67964209.tdop)
c:RegisterEffect(e1)
end
function c67964209.cfilter(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER)
end
function c67964209.tdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,c67964209.cfilter,1,e:GetHandler()) end
local g=Duel.SelectReleaseGroup(tp,c67964209.cfilter,1,1,e:GetHandler())
Duel.Release(g,REASON_COST)
end
function c67964209.filter(c)
local tpe=c:GetType()
return bit.band(tpe,TYPE_SPELL)~=0 and bit.band(tpe,TYPE_CONTINUOUS+TYPE_FIELD)~=0 and c:IsAbleToDeck()
end
function c67964209.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c67964209.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c67964209.filter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c67964209.filter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c67964209.tdop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoDeck(tc,nil,0,REASON_EFFECT)
end
end
| gpl-2.0 |
Turttle/darkstar | scripts/zones/Bhaflau_Thickets/npcs/Kamih_Mapokhalam.lua | 19 | 1726 | -----------------------------------
-- Area: Bhaflau Thickets
-- NPC: Kamih Mapokhalam
-- 20 -30 597 z 52
-----------------------------------
package.loaded["scripts/zones/Bhaflau_Thickets/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/zones/Bhaflau_Thickets/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
count = trade:getItemCount();
if (count == 1 and trade:hasItemQty(2185,1)) then -- Silver
player:tradeComplete();
player:startEvent(0x0079);
elseif (count == 3 and trade:hasItemQty(2186,3)) then -- Mythril
if (player:hasKeyItem(MAP_OF_ALZADAAL_RUINS)) then
player:startEvent(0x0093);
else
player:startEvent(0x0092);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getZPos() < 597) then
player:startEvent(0x0078);
else
player:startEvent(0x007A);
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x0079) then
player:setPos(325.137,-3.999,-619.968,0,72); -- To Alzadaal Undersea Ruins G-8 {R}
elseif (csid == 0x0092) then
player:tradeComplete();
player:addKeyItem(MAP_OF_ALZADAAL_RUINS);
player:messageSpecial(KEYITEM_OBTAINED,MAP_OF_ALZADAAL_RUINS);
end
end; | gpl-3.0 |
dickeyf/darkstar | scripts/zones/Sacrificial_Chamber/npcs/_4j4.lua | 13 | 1420 | -----------------------------------
-- Area: Sacrificial Chamber
-- NPC: Mahogany Door
-- @pos 300 30 -324 163
-------------------------------------
package.loaded["scripts/zones/Sacrificial_Chamber/TextIDs"] = nil;
-------------------------------------
require("scripts/globals/bcnm");
require("scripts/globals/missions");
require("scripts/zones/Sacrificial_Chamber/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (TradeBCNM(player,player:getZoneID(),trade,npc)) then
return;
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (EventTriggerBCNM(player,npc)) then
return 1;
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("onUpdate CSID: %u",csid);
--printf("onUpdate RESULT: %u",option);
if (EventUpdateBCNM(player,csid,option)) then
return;
end
end;
-----------------------------------
-- onEventFinish Action
-----------------------------------
function onEventFinish(player,csid,option)
--printf("onFinish CSID: %u",csid);
--printf("onFinish RESULT: %u",option);
if (EventFinishBCNM(player,csid,option)) then
return;
end
end; | gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c66540884.lua | 7 | 1243 | --トリック・デーモン
function c66540884.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66540884,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCountLimit(1,66540884)
e1:SetCondition(c66540884.thcon)
e1:SetTarget(c66540884.thtg)
e1:SetOperation(c66540884.thop)
c:RegisterEffect(e1)
end
function c66540884.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) or c:IsReason(REASON_BATTLE)
end
function c66540884.thfilter(c)
return c:IsSetCard(0x45) and c:GetCode()~=66540884 and c:IsAbleToHand()
end
function c66540884.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c66540884.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c66540884.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c66540884.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c98252586.lua | 4 | 1660 | --フォロー・ウィンド
function c98252586.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c98252586.target)
e1:SetOperation(c98252586.operation)
c:RegisterEffect(e1)
--atk up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(300)
c:RegisterEffect(e2)
--def up
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_DEFENSE)
e3:SetValue(300)
c:RegisterEffect(e3)
--equip limit
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_EQUIP_LIMIT)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetValue(c98252586.eqlimit)
c:RegisterEffect(e4)
end
function c98252586.eqlimit(e,c)
return c:IsRace(RACE_WINDBEAST)
end
function c98252586.filter(c)
return c:IsFaceup() and c:IsRace(RACE_WINDBEAST)
end
function c98252586.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c98252586.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c98252586.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c98252586.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c98252586.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c99189322.lua | 5 | 2281 | --アルカナコール
function c99189322.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c99189322.target)
e1:SetOperation(c99189322.activate)
c:RegisterEffect(e1)
end
function c99189322.filter(c)
return c:GetFlagEffect(36690018)~=0
end
function c99189322.rfilter(c)
return c:IsSetCard(0x5) and c:IsAbleToRemove()
end
function c99189322.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c99189322.filter,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingTarget(c99189322.rfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c99189322.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,c99189322.rfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
e:SetLabelObject(g:GetFirst())
end
function c99189322.activate(e,tp,eg,ep,ev,re,r,rp)
local regc=e:GetLabelObject()
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tc=g:GetFirst()
if tc==regc then tc=g:GetNext() end
if tc:IsRelateToEffect(e) and tc:IsFaceup() and c99189322.filter(tc) and regc:IsRelateToEffect(e) then
Duel.Remove(regc,POS_FACEUP,REASON_EFFECT)
local regfun=regc.arcanareg
if not regfun then return end
local val=tc:GetFlagEffectLabel(36690018)
tc:ResetEffect(RESET_DISABLE,RESET_EVENT)
regfun(tc,val)
tc:RegisterFlagEffect(99189322,RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END,0,1)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabelObject(tc)
e1:SetOperation(c99189322.rec_effect)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
function c99189322.rec_effect(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffect(99189322)==0 or tc:GetFlagEffect(36690018)==0 then return end
local regfun=tc.arcanareg
if not regfun then return end
local val=tc:GetFlagEffectLabel(36690018)
tc:ResetEffect(RESET_DISABLE,RESET_EVENT)
regfun(tc,val)
end
| gpl-2.0 |
dickeyf/darkstar | scripts/globals/weaponskills/shadowstitch.lua | 1 | 1562 | -----------------------------------
-- Shadowstitch
-- Dagger weapon skill
-- Skill level: 70
-- Binds target. Chance of binding varies with TP.
-- Does stack with Sneak Attack.
-- Aligned with the Aqua Gorget.
-- Aligned with the Aqua Belt.
-- Element: None
-- Modifiers: CHR:100%
-- 100%TP 200%TP 300%TP
-- 1.00 1.00 1.00
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary)
local params = {};
params.numHits = 1;
params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1;
params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.3;
params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0;
params.canCrit = false;
params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0;
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.chr_wsc = 1.0;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, primary);
if (damage > 0) then
local tp = player:getTP();
local duration = (tp/100 * 5) + 5;
if (target:hasStatusEffect(EFFECT_BIND) == false) then
target:addStatusEffect(EFFECT_BIND, 1, 0, duration);
end
end
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
sevenbot/teamseven | plugins/rae.lua | 616 | 1312 | do
function getDulcinea( text )
-- Powered by https://github.com/javierhonduco/dulcinea
local api = "http://dulcinea.herokuapp.com/api/?query="
local query_url = api..text
local b, code = http.request(query_url)
if code ~= 200 then
return "Error: HTTP Connection"
end
dulcinea = json:decode(b)
if dulcinea.status == "error" then
return "Error: " .. dulcinea.message
end
while dulcinea.type == "multiple" do
text = dulcinea.response[1].id
b = http.request(api..text)
dulcinea = json:decode(b)
end
local text = ""
local responses = #dulcinea.response
if responses == 0 then
return "Error: 404 word not found"
end
if (responses > 5) then
responses = 5
end
for i = 1, responses, 1 do
text = text .. dulcinea.response[i].word .. "\n"
local meanings = #dulcinea.response[i].meanings
if (meanings > 5) then
meanings = 5
end
for j = 1, meanings, 1 do
local meaning = dulcinea.response[i].meanings[j].meaning
text = text .. meaning .. "\n\n"
end
end
return text
end
function run(msg, matches)
return getDulcinea(matches[1])
end
return {
description = "Spanish dictionary",
usage = "!rae [word]: Search that word in Spanish dictionary.",
patterns = {"^!rae (.*)$"},
run = run
}
end | gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c61156777.lua | 2 | 2359 | --BOXサー
function c61156777.initial_effect(c)
c:EnableCounterPermit(0x34)
--Add counter
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(61156777,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(aux.bdogcon)
e1:SetOperation(c61156777.ctop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(61156777,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c61156777.spcost)
e2:SetTarget(c61156777.sptg)
e2:SetOperation(c61156777.spop)
c:RegisterEffect(e2)
--destroy replace
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_DESTROY_REPLACE)
e3:SetTarget(c61156777.reptg)
e3:SetOperation(c61156777.repop)
c:RegisterEffect(e3)
end
function c61156777.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
c:AddCounter(0x34,1)
end
end
function c61156777.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() and e:GetHandler():GetCounter(0x34)>1 end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c61156777.filter(c,e,tp)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c61156777.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c61156777.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c61156777.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,c61156777.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)
end
end
function c61156777.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x34,1,REASON_EFFECT) end
return Duel.SelectYesNo(tp,aux.Stringid(61156777,2))
end
function c61156777.repop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RemoveCounter(tp,0x34,1,REASON_EFFECT)
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c100000530.lua | 2 | 3618 | --集いし願い
function c100000530.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c100000530.target)
e1:SetOperation(c100000530.operation)
c:RegisterEffect(e1)
end
function c100000530.vfilter(c)
return c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_DRAGON)
end
function c100000530.sfilter(c,e,tp)
return c:GetCode()==44508094 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c100000530.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c100000530.filter1(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c100000530.sfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp)
and Duel.GetMatchingGroup(c100000530.vfilter,tp,LOCATION_GRAVE,0,nil):GetCount()>4 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c100000530.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.GetFirstMatchingCard(c100000530.sfilter,tp,LOCATION_EXTRA,0,nil,e,tp)
if c:IsRelateToEffect(e)
and Duel.SpecialSummonStep(tg,0,tp,tp,false,false,POS_FACEUP) then
c:SetCardTarget(tg)
Duel.Equip(tp,c,tg)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(c100000530.val)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(c100000530.eqlimit)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
--chain attack
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(100000530,0))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_BATTLE_DESTROYING)
e3:SetCondition(c100000530.atcon)
e3:SetCost(c100000530.cost)
e3:SetOperation(c100000530.atop)
e3:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetOperation(c100000530.desop)
e4:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e4:SetCountLimit(1)
tg:RegisterEffect(e4)
Duel.SpecialSummonComplete()
end
end
function c100000530.val(e,c)
local g=Duel.GetMatchingGroup(c100000530.vfilter,c:GetControler(),LOCATION_GRAVE,0,c)
return g:GetSum(Card.GetBaseAttack)
end
function c100000530.eqlimit(e,c)
return c:GetCode()==44508094
end
function c100000530.sendfilter(c)
return c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_DRAGON) and c:IsAbleToExtra()
end
function c100000530.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c100000530.sendfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,c100000530.sendfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SendtoDeck(g,nil,1,REASON_COST)
end
function c100000530.atcon(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetHandler():GetEquipTarget()
if not eg:IsContains(ec) then return false end
local bc=ec:GetBattleTarget()
return bc:IsReason(REASON_BATTLE)
end
function c100000530.atop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChainAttack()
end
function c100000530.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT)
end | gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c51435705.lua | 4 | 1581 | --先史遺産クリスタル・スカル
function c51435705.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(51435705,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,51435705)
e1:SetCondition(c51435705.shcon)
e1:SetCost(c51435705.shcost)
e1:SetTarget(c51435705.shtg)
e1:SetOperation(c51435705.shop)
c:RegisterEffect(e1)
end
function c51435705.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x70)
end
function c51435705.shcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c51435705.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c51435705.shcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsDiscardable() and e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_DISCARD+REASON_COST)
end
function c51435705.filter(c)
return c:IsSetCard(0x70) and c:GetCode()~=51435705 and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c51435705.shtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c51435705.filter,tp,LOCATION_GRAVE+LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE+LOCATION_DECK)
end
function c51435705.shop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c51435705.filter),tp,LOCATION_GRAVE+LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
| gpl-2.0 |
mimetic/DIG-corona-library | examples/dialog/scripts/dialog/settings_gui.lua | 2 | 16691 | -- settings_gui.lua
--
-- Version 0.1
--
-- Copyright (C) 2013 David I. Gross. All Rights Reserved.
--
-- This software is is protected by the author's copyright, and may not be used, copied,
-- modified, merged, published, distributed, sublicensed, and/or sold, without
-- written permission of the author.
--
-- The above copyright notice and this permission notice shall be included in all copies
-- or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
-- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
-- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
--
--[[
Allow user to manage settings using dialog screens.
--]]
local funx = require( "scripts.funx" )
--module table
local M = {}
local pathToModule = "scripts/dialog/"
-- Local settings for an app, e.g. current user, etc.
M.values = {}
-- This creates a dialog generator function
local dialog = require ("scripts.dialog.dialog")
-- Be CAREFUL not to use names of existing lua files, e.g. settings.lua unless you mean it!!!
local settingsDialogName = "settingsDialog"
local signInDialogName = "signinDialog"
local newAccountDialogName = "createAccountDialog"
-- Should we use Modal dialogs or let them stick around?
-- Probably not if we want dialogs to be able to jump around. If we allow modal,
-- then dialogs can lose their scenes, not a good thing.
local isModal = false
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--[[
Wordpress connection
Verify the user with WordPress
--]]
local mb_api = require ("mb_api")
--------------------------------------------
local screenW, screenH = display.contentWidth, display.contentHeight
local viewableScreenW, viewableScreenH = display.viewableContentWidth, display.viewableContentHeight
local screenOffsetW, screenOffsetH = display.contentWidth - display.viewableContentWidth, display.contentHeight - display.viewableContentHeight
local midscreenX = screenW*(0.5)
local midscreenY = screenH*(0.5)
local error_messages = {
email_invalid = "Invalid email",
email_exists = "Email already in use",
username_invalid = "Username not acceptable",
api_key_invalid = "My Mistake: Invalid API key!",
user_creation_failed = "Account creation failed, I don't know why.",
username_exists = "Username already in use.",
}
--- Get user information from WordPress
-- @param url The URL of the website to contact
-- @param username The username
-- @param password
-- @param onSuccess Function to run on success
-- @param onFailure Function to run on failure
-- @return
local function getUserInfo(url, username, password, onSuccess, onFailure)
function onError(result)
print ("getUserInfo: ERROR:")
funx.dump(result)
end
function onSuccess(result)
print ("getUserInfo: onSuccess:")
funx.dump(result)
end
--------------------------------------------
local url = "http://localhost/photobook/wordpress/"
mb_api.getUserInfo(url, username, password, onSuccess, onError)
return true
end
--- Update the settings window with the values
-- This is useful after signing in and update the values.
-- @return
local function updateSettingsDialog()
if (dialog.window[settingsDialogName].exists) then
local dialogName = "settings"
local id = "username"
local newText = "You are signed in as <span font='Avenir-Black'>{username}</span> (<span font='Avenir-Black'>{displayname}</span>)"
local f = { text = newText }
dialog:replaceTextBlock(settingsDialogName, id, f, M.values.user)
-- Update the sign in/out button
local f = {
label = "Sign Out",
functionName = "signOutUser",
}
local id = "signOut"
dialog:replaceButton(settingsDialogName, id, f, M.values.user)
end
end
--- Set the conditions table based on the current M.values table
-- @return conditions
local function setConditions(windowName)
local conditions = {}
conditions = {
signout = M.values.user.authorized or false, -- make sure it is boolean (could be nil!)
signin = not M.values.user.authorized,
}
if (windowName) then
dialog.window[windowName].conditions = conditions
end
--funx.tellUser("setConditions:Authorized:".. tostring(M.values.user.authorized))
return conditions
end
--- Set the conditions table based on the current M.values table
-- @return conditions
local function updateConditions(windowName)
local conditions = {}
conditions = {
signout = M.values.user.authorized or false, -- make sure it is boolean (could be nil!)
signin = not M.values.user.authorized,
}
if (windowName) then
dialog.window[windowName].conditions = conditions
end
--funx.tellUser("setConditions:Authorized:".. tostring(M.values.user.authorized))
return conditions
end
--- Update a dialog.window table to use the current 'values'
local function updateDialogParams(windowName)
dialog.window[windowName].params.substitutions = M.values.user
end
------------------------------------------------------------------------
--- Show a dialog
-- @param windowname
-- @param values (optional) updated key/value set used for substitutions in fields + texts
-- @param conditions (optional) updated conditions table
-- @return
local function showDialog(windowName)
local conditions = updateConditions(windowName)
dialog:showWindow(windowName, M.values.user, conditions)
end
------------------------------------------------------------------------
--- SIGN IN dialog
-- @return
local function showSettingsDialog()
showDialog(settingsDialogName)
end
--- If the user exists, update new info about the user taken from the WP website.
-- @param results
-- @return
local function signin_user(results)
local username = results.username
local password = results.password
local url = "http://localhost/photobook/wordpress/"
function onError(mb_api_result)
funx.tellUser(mb_api_result.error)
print ("signin_user: ERROR")
funx.dump(mb_api_result)
-- Set the conditionals for this dialog
dialog.window[signInDialogName].conditions.authorized = false
showSettingsDialog()
return false
end
-- I think that Success ONLY means the network transaction worked!
function onSuccess(mb_api_result)
if (mb_api_result.status == "ok") then
funx.tellUser("Sign In for '"..results.username .. "' confirmed.")
M.values.user = funx.tableMerge(M.values.user, mb_api_result.user)
M.values.user.authorized = true
showSettingsDialog()
--updateSettingsDialog()
return true
else
funx.tellUser("Sign In for '"..results.username .. "' failed!")
return false
end
end
--------------------------------------------
mb_api.getUserInfo(url, username, password, onSuccess, onError)
return true
end
--
--- If the user exists, update new info about the user taken from the WP website.
-- @param results
-- @return
local function verify_user(results)
function onError(mb_api_result)
funx.tellUser(mb_api_result.error)
print ("verify_user: ERROR")
funx.dump(mb_api_result)
return false
end
-- I think that Success ONLY means the network transaction worked!
function onSuccess(mb_api_result)
funx.tellUser("Sign In for '"..results.username .. "' confirmed.")
-- Update values
--local newvalues = { firstname = result.user.firstname, lastname = result.user.lastname, displayname = result.user.displayname }
--dialog:addValuesToDocuments(signInDialogName, newvalues, showSavedFeedback)
return true
end
--------------------------------------------
local username = results.username
local password = results.password
local url = "http://localhost/photobook/wordpress/"
mb_api.getUserInfo(url, username, password, onSuccess, onError)
return true
end
--------------------------------------------------------------------------------
-- Shortcut functions
--- Shortcut to show sign-in dialog
local function showSignInUserDialog()
showDialog(signInDialogName)
end
--- Shortcut to show the create-new-account dialog
local function openCreateNewAccountDialog()
showDialog(newAccountDialogName)
end
--- Show the create new account dialog
local function confirmAccount(results)
return verify_user(results)
end
--------------------------------------------------------------------------------
-- If the user exists, update new info about the user taken from the WP website.
-- The username, etc., might come back altered, e.g. user --> user_001
-- So we must update the values.
-- Return true -> finished with dialog, do closing function
-- Return false -> failure, keep dialog open so use can try again
local function createNewAccount(results)
function onError(mb_api_result)
funx.tellUser(mb_api_result.error)
print ("createNewAccount:", error_messages[mb_api_result.error])
return false
end
-- Success ONLY means the network transaction worked!
function onSuccess(mb_api_result)
if (mb_api_result.status == "error") then
funx.tellUser(error_messages[mb_api_result.error])
print ("createNewAccount:", error_messages[mb_api_result.error])
return false
else
funx.tellUser("Account created.")
print ("createNewAccount:", "Account created")
-- Get updated values
local newvalues = {
username = mb_api_result.username,
password = mb_api_result.password,
email = mb_api_result.email,
firstname = mb_api_result.firstname,
lastname = mb_api_result.lastname,
displayname = mb_api_result.displayname,
}
-- ***** THIS VALUE????
local showSavedFeedback = false
dialog:addValuesToDocuments(newAccountDialogName, newvalues, showSavedFeedback)
-- Update the settings dialog, too!
dialog:addValuesToDocuments(signInDialogName, newvalues, showSavedFeedback)
-- Add values to the main 'values' table
M.values.user = funx.tableMerge(M.values.user, newvalues)
showSignInUserDialog()
return true
end
end
--------------------------------------------
-- In this case, username/pass have to be an admin user
-- who can create new accounts!!!!
local username = "admin"
local password = "nookie"
local url = "http://localhost/photobook/wordpress/"
mb_api.register_user(url, username, password, results, onSuccess, onError)
return false
end
local function cancelled(results)
funx.tellUser ("Cancelled")
end
------------------------------------------------------------------------
-- SIGN IN dialog
-- Create a dialog window to sign in
-- @param dialogName Name of the dialog window
-- @return
local function createSignInDialog(dialogName)
local options = {
effect = "fade",
time = 250,
isModal = isModal,
}
-- Options for the dialog builder
local params = {
name = dialogName,
substitutions = M.values.user,
restoreValues = false, -- restore previous results from disk
writeValues = false, -- save the results to disk
onSubmitButton = nil, -- set this function or have another scene check dialogResults
--onCancelButton = showSettingsDialog, -- set this function or have another scene check dialogResults
cancelToSceneName = settingsDialogName,
showSavedFeedback = false, -- show "saved" if save succeeds
options = options,
isModal = isModal,
functions = {
createNewAccountDialog = openCreateNewAccountDialog,
confirmAccount = confirmAccount,
signin = {
action = signin_user,
success = nil,
failure = nil,
},
},
cancelToSceneName = settingsDialogName,
}
-- Creates a new dialog scene
dialog.new(params)
end
------------------------------------------------------------------------
--- Create New account dialog
-- @param dialogName Name of the dialog window
-- @return
local function createNewAccountDialog(dialogName)
-- Success just means the network didn't fail!
local function onSuccess(results)
print ("createNewAccountDialog:onSuccess: ")
funx.dump(results)
showSignInUserDialog()
end
local function onFailure(results)
funx.tellUser("Error: Probably a network connection error.")
end
local options = {
effect = "fade",
time = 250,
isModal = isModal,
}
-- Options for the dialog builder
local params = {
name = dialogName,
substitutions = M.values.user,
restoreValues = true, -- restore previous results from disk
writeValues = true, -- save the results to disk
onSubmitButton = nil, -- set this function or have another scene check dialogResults
--onCancelButton = showSettingsDialog, -- set this function or have another scene check dialogResults
cancelToSceneName = settingsDialogName,
showSavedFeedback = false, -- show "saved" if save succeeds
options = options,
isModal = isModal,
functions = {
createAccount = {
action = createNewAccount,
success = nil,
failure = nil,
},
},
}
------------------------------------------------------------------------
-- Creates a new dialog scene
dialog.new(params)
end
--- Sign Out in settings dialog
-- @return
local function signOutUserInSettings()
local currentUserName = ""
local currentUserFullName = ""
-- Update the username text block
local dialogName = "settings"
M.values.user.authorized = false
M.values.user.username = ""
M.values.user.password= ""
M.values.user.displayname = ""
local conditions = {
signout = M.values.user.authorized or false, -- make sure it is boolean (could be nil!)
signin = not M.values.user.authorized,
}
dialog:updateDialogByConditions(settingsDialogName, conditions)
end
------------------------------------------------------------------------
--- SETTINGS dialog
-- @param callback the function to call when user closes/cancels.
-- @return
local function createSettingsDialog(callback)
-- Results are of the last closed dialog, not all results
-- Merge these results into the final values that we return to the callback function.
local function onCompletion(results)
M.values = funx.tableMerge(M.values, results)
--dialog:removeWindow(settingsDialogName)
if (type(callback) == "function") then
callback( M.values )
end
end
-- Options for the composer
local options = {
effect = "fade",
time = 250,
isModal = isModal,
}
-- Set the INITIAL conditions which control what is displayed.
-- Params should update these conditions if the window is recreated
local conditions = {
signout = M.values.user.authorized or false, -- make sure it is boolean (could be nil!)
signin = not M.values.user.authorized,
}
-- Options for the dialog builder
local params = {
name = settingsDialogName,
substitutions = M.values.user,
restoreValues = false, -- restore previous results from disk
writeValues = false, -- save the results to disk
onSubmitButton = onCompletion, -- set this function or have another scene check dialogResults
onCancelButton = onCompletion, -- set this function or have another scene check dialogResults
cancelToSceneName = storyboard.getCurrentSceneName(), -- cancel to the scene that called this dialog
showSavedFeedback = false, -- show "saved" if save succeeds
options = options,
isModal = isModal,
functions = {
createNewAccountDialog = openCreateNewAccountDialog,
signOutUser = {
action = signOutUserInSettings,
success = createSettingsDialog,
failure = nil,
},
signInUser = {
action = showSignInUserDialog,
success = nil,
failure = nil,
},
},
--conditions = conditions,
}
------------------------------------------------------------------------
-- Creates a new dialog scene
dialog.new(params)
end
local function init(values, onCompletion)
M.values = values
createSignInDialog(signInDialogName)
createNewAccountDialog(newAccountDialogName)
createSettingsDialog(onCompletion)
end
-- functions
M.init = init
M.showSettingsDialog = showSettingsDialog
M.showDialog = showDialog
return M
| mit |
Turttle/darkstar | scripts/globals/abilities/addendum_black.lua | 28 | 1632 | -----------------------------------
-- Ability: Addendum: Black
-- Allows access to additional Black Magic spells while using Dark Arts.
-- Obtained: Scholar Level 30
-- Recast Time: Stratagem Charge
-- Duration: 2 hours
--
-- Level |Charges |Recharge Time per Charge
-- ----- -------- ---------------
-- 10 |1 |4:00 minutes
-- 30 |2 |2:00 minutes
-- 50 |3 |1:20 minutes
-- 70 |4 |1:00 minute
-- 90 |5 |48 seconds
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/status");
-----------------------------------
-- onAbilityCheck
-----------------------------------
function onAbilityCheck(player,target,ability)
if player:hasStatusEffect(EFFECT_ADDENDUM_BLACK) then
return MSGBASIC_EFFECT_ALREADY_ACTIVE, 0;
end
return 0,0;
end;
-----------------------------------
-- onUseAbility
-----------------------------------
function onUseAbility(player,target,ability)
player:delStatusEffectSilent(EFFECT_LIGHT_ARTS);
player:delStatusEffectSilent(EFFECT_ADDENDUM_WHITE);
player:delStatusEffectSilent(EFFECT_DARK_ARTS);
local skillbonus = player:getMod(MOD_DARK_ARTS_SKILL);
local effectbonus = player:getMod(MOD_DARK_ARTS_EFFECT);
local helixbonus = 0;
if (player:getMainJob() == JOB_SCH and player:getMainLvl() >= 20) then
helixbonus = math.floor(player:getMainLvl() / 4);
end
player:addStatusEffectEx(EFFECT_ADDENDUM_BLACK,EFFECT_ADDENDUM_BLACK,effectbonus,0,7200,0,helixbonus,true);
return EFFECT_ADDENDUM_BLACK;
end; | gpl-3.0 |
mrvigeo/salib | plugins/stats.lua | 866 | 4001 | do
-- Returns a table with `name` and `msgs`
local function get_msgs_user_chat(user_id, chat_id)
local user_info = {}
local uhash = 'user:'..user_id
local user = redis:hgetall(uhash)
local um_hash = 'msgs:'..user_id..':'..chat_id
user_info.msgs = tonumber(redis:get(um_hash) or 0)
user_info.name = user_print_name(user)..' ['..user_id..']'
return user_info
end
local function chat_stats(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
local file = io.open("./groups/lists/"..chat_id.."stats.txt", "w")
file:write(text)
file:flush()
file:close()
send_document("chat#id"..chat_id,"./groups/lists/"..chat_id.."stats.txt", ok_cb, false)
return --text
end
local function chat_stats2(chat_id)
-- Users on chat
local hash = 'chat:'..chat_id..':users'
local users = redis:smembers(hash)
local users_info = {}
-- Get user info
for i = 1, #users do
local user_id = users[i]
local user_info = get_msgs_user_chat(user_id, chat_id)
table.insert(users_info, user_info)
end
-- Sort users by msgs number
table.sort(users_info, function(a, b)
if a.msgs and b.msgs then
return a.msgs > b.msgs
end
end)
local text = 'users in this chat \n'
for k,user in pairs(users_info) do
text = text..user.name..' = '..user.msgs..'\n'
end
return text
end
-- Save stats, ban user
local function bot_stats()
local redis_scan = [[
local cursor = '0'
local count = 0
repeat
local r = redis.call("SCAN", cursor, "MATCH", KEYS[1])
cursor = r[1]
count = count + #r[2]
until cursor == '0'
return count]]
-- Users
local hash = 'msgs:*:'..our_id
local r = redis:eval(redis_scan, 1, hash)
local text = 'Users: '..r
hash = 'chat:*:users'
r = redis:eval(redis_scan, 1, hash)
text = text..'\nGroups: '..r
return text
end
local function run(msg, matches)
if matches[1]:lower() == 'teleseed' then -- Put everything you like :)
local about = _config.about_text
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] used /teleseed ")
return about
end
if matches[1]:lower() == "statslist" then
if not is_momod(msg) then
return "For mods only !"
end
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats2(chat_id)
end
if matches[1]:lower() == "stats" then
if not matches[2] then
if not is_momod(msg) then
return "For mods only !"
end
if msg.to.type == 'chat' then
local chat_id = msg.to.id
local name = user_print_name(msg.from)
savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ")
return chat_stats(chat_id)
else
return
end
end
if matches[2] == "teleseed" then -- Put everything you like :)
if not is_admin(msg) then
return "For admins only !"
else
return bot_stats()
end
end
if matches[2] == "group" then
if not is_admin(msg) then
return "For admins only !"
else
return chat_stats(matches[3])
end
end
end
end
return {
patterns = {
"^[!/]([Ss]tats)$",
"^[!/]([Ss]tatslist)$",
"^[!/]([Ss]tats) (group) (%d+)",
"^[!/]([Ss]tats) (teleseed)",-- Put everything you like :)
"^[!/]([Tt]eleseed)"-- Put everything you like :)
},
run = run
}
end
| gpl-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c30811116.lua | 2 | 3199 | --幻獣機レイステイルス
function c30811116.initial_effect(c)
--level
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(c30811116.lvval)
c: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_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c30811116.indcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e3)
--token
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(30811116,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_BATTLE_DAMAGE)
e4:SetCondition(c30811116.spcon)
e4:SetTarget(c30811116.sptg)
e4:SetOperation(c30811116.spop)
c:RegisterEffect(e4)
--destroy
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(30811116,1))
e5:SetCategory(CATEGORY_DESTROY)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_MZONE)
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetCountLimit(1)
e5:SetCost(c30811116.descost)
e5:SetTarget(c30811116.destg)
e5:SetOperation(c30811116.desop)
c:RegisterEffect(e5)
end
function c30811116.lvval(e,c)
local tp=c:GetControler()
local lv=0
for i=0,4 do
local tc=Duel.GetFieldCard(tp,LOCATION_MZONE,i)
if tc and tc:IsCode(31533705) then lv=lv+tc:GetLevel() end
end
return lv
end
function c30811116.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c30811116.spcon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp
end
function c30811116.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c30811116.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if Duel.IsPlayerCanSpecialSummonMonster(tp,31533705,0x101b,0x4011,0,0,3,RACE_MACHINE,ATTRIBUTE_WIND) then
local token=Duel.CreateToken(tp,30811117)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
end
end
function c30811116.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsType,1,nil,TYPE_TOKEN) end
local g=Duel.SelectReleaseGroup(tp,Card.IsType,1,1,nil,TYPE_TOKEN)
Duel.Release(g,REASON_COST)
end
function c30811116.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c30811116.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and c30811116.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c30811116.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c30811116.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c30811116.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
dickeyf/darkstar | scripts/globals/weaponskills/avalanche_axe.lua | 11 | 1349 | -----------------------------------
-- Avalanche Axe
-- Axe weapon skill
-- Skill level: 100
-- Delivers a single-hit attack. Damage varies with TP.
-- Will stack with Sneak Attack.
-- Aligned with the Soil Gorget & Thunder Gorget.
-- Aligned with the Soil Belt & Thunder Belt.
-- Element: None
-- Modifiers: STR:30%
-- 100%TP 200%TP 300%TP
-- 1.50 2.00 2.50
-----------------------------------
require("scripts/globals/status");
require("scripts/globals/settings");
require("scripts/globals/weaponskills");
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary)
local params = {};
params.numHits = 1;
params.ftp100 = 1.5; params.ftp200 = 2; params.ftp300 = 2.5;
params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0;
params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0;
params.canCrit = false;
params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0;
params.atkmulti = 1;
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.str_wsc = 0.6;
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, primary);
return tpHits, extraHits, criticalHit, damage;
end
| gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c100000537.lua | 2 | 1543 | --ワルキューレ・アルテスト
function c100000537.initial_effect(c)
--
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100000537,0))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetTarget(c100000537.target)
e2:SetOperation(c100000537.operation)
c:RegisterEffect(e2)
end
function c100000537.sfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemove()
end
function c100000537.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and chkc:IsType(TYPE_MONSTER) end
if chk==0 then return Duel.IsExistingTarget(c100000537.sfilter,1-tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,c100000537.sfilter,1-tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
end
function c100000537.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsAbleToRemove() then
if Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=1 then return end
local ba=tc:GetBaseAttack()
local reset_flag=RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(reset_flag)
e2:SetCode(EFFECT_SET_ATTACK)
e2:SetValue(ba)
c:RegisterEffect(e2)
end
end
| gpl-2.0 |
dickeyf/darkstar | scripts/zones/North_Gustaberg_[S]/npcs/Gebhardt.lua | 13 | 1257 | -----------------------------------
-- Area: North Gustaberg (S) (I-6)
-- NPC: Gebhardt
-- Involved in Quests: The Fighting Fourth
-----------------------------------
package.loaded["scripts/zones/North_Gustaberg_[S]/TextIDs"] = nil;
package.loaded["scripts/globals/quests"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/zones/North_Gustaberg_[S]/TextIDs");
require("scripts/globals/keyitems");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getQuestStatus(CRYSTAL_WAR,THE_FIGHTING_FOURTH) == QUEST_ACCEPTED and player:hasKeyItem(917)) == true then
player:startEvent(0x0066)
else
player:startEvent(0x006E)
end
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x0066) then
player:delKeyItem(BATTLE_RATIONS);
player:setVar("THE_FIGHTING_FOURTH",1);
end
end;
| gpl-3.0 |
aukondk/interspace | ai.lua | 1 | 3008 | --[[Interspace AI routines
Copyright (C) 2012 Stephen Ward (Aukondk) aukondk.com bluedrava.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>--]]
ai = {}
--base AI for flying ship, could be used for player autopilot
function ai:newPilot(ship)
self = {}
self.ship = ship
self.target = {}
return self
end
function ai:newEnemy(ship)
self = ai:newPilot(ship)
self.update = function (dt) ai.attack(self, objects.ships.player) end
return self
end
function ai:newNeutral(ship)
self = ai:newPilot(ship)
--Initial target is object start position. Later if target is in range of position then next sequence is triggered.
self.target.x = self.ship.body:getX()
self.target.y = self.ship.body:getY()
self.update = function (dt) ai.roam(self) end
return self
end
function ai.roam(current)
-- When in range of target area, pic new one at random.
if ((current.target.x >= current.ship.body:getX()-100) and (current.target.x < current.ship.body:getX()+100)) and ((current.target.y >= current.ship.body:getY()-100) and (current.target.y < current.ship.body:getY()+100)) then
current.target.x = math.random(100, worldloop - 100)
current.target.y = math.random(100, worldloop - 100)
print(current.target.x, current.target.y)
end
ai.moveto(current.ship, current.target)
end
function ai.attack(current, target)
current.target.x = target.body:getX()
current.target.y = target.body:getY()
local distance = vector(current.target.x,current.target.y) - vector(current.ship.body:getX(),current.ship.body:getY())
if (distance:len() < 100) then
--current.shoot()
end
ai.moveto(current.ship, current.target)
end
function ai.moveto(ship, target)
local vector1 = vector(ship.body:getX(),ship.body:getY())
local vector2 = vector(target.x,target.y)
local distance = vector2 - vector1
local force = 1
local normforce = force*distance
local velx, vely = ship.body:getLinearVelocity()
local vel = math.sqrt(velx^2 + vely^2)
if ((distance:len() > 10) and (vel < 500)) then
ship.body:setLinearDamping(0) --handbrake off
ship.body:applyForce(normforce.x,normforce.y)
elseif ((distance:len() > 10) and (vel > 500)) then
ship.body:setLinearDamping(1)
--ship.body:applyForce(-normforce.x,-normforce.y)
elseif ((distance:len() <= 100)) then
ship.body:setLinearDamping(2) --handbrake on
end
end
| gpl-3.0 |
Turttle/darkstar | scripts/zones/RuLude_Gardens/npcs/_6r8.lua | 17 | 2384 | -----------------------------------
-- Area: Ru'Lud Gardens
-- Door: Windurstian Ambassador
-- Windurst Missions 3.3 "A New Journey" and 4.1 "Magicite"
-- @pos 31 9 -22 243
-----------------------------------
package.loaded["scripts/zones/RuLude_Gardens/TextIDs"] = nil;
package.loaded["scripts/globals/missions"] = nil;
-----------------------------------
require("scripts/globals/keyitems");
require("scripts/globals/missions");
require("scripts/zones/RuLude_Gardens/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
pNation = player:getNation();
currentMission = player:getCurrentMission(pNation);
MissionStatus = player:getVar("MissionStatus");
if (currentMission == A_NEW_JOURNEY and MissionStatus == 4) then
player:startEvent(0x0028);
elseif (player:getRank() == 4 and MissionStatus == 0 and player:getCurrentMission(WINDURST) == 255 and getMissionRankPoints(player,13) == 1) then
if (player:hasKeyItem(ARCHDUCAL_AUDIENCE_PERMIT)) then
player:startEvent(0x0083,1);
else
player:startEvent(0x0083);
end
elseif (player:getRank() >= 4) then
player:messageSpecial(WINDURST_EMBASSY); -- restricted area
else
player:messageSpecial(WINDURST_EMBASSY + 1); -- you have no letter of introduction
end
return 1;
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("RESULT: %u",option);
if (csid == 0x0028) then
finishMissionTimeline(player,1,csid,option);
elseif (csid == 0x0083 and option == 1) then
player:setVar("MissionStatus",1);
if (player:hasKeyItem(ARCHDUCAL_AUDIENCE_PERMIT) == false) then
player:addKeyItem(ARCHDUCAL_AUDIENCE_PERMIT);
player:messageSpecial(KEYITEM_OBTAINED,ARCHDUCAL_AUDIENCE_PERMIT);
end
elseif (csid == 0x0026 or csid == 0x0023) then
finishMissionTimeline(player,1,csid,option);
end
end; | gpl-3.0 |
lionsoul2014/ip2region | v1.0/binding/lua/testSearcher.lua | 2 | 2370 | --[[
ip2region lua client test script
@author chenxin<chenxin619315@gmail.com>
]]--
-- check the command line arguments
if ( not arg[1] ) then
print([[
Usage: lua testSearcher.lua [ip2region db file] [algorithm]
+-Optional Algorithm: binary, b-tree, memory]]);
os.exit();
end
local Ip2region = require "Ip2region";
-- local cjson = require "cjson";
-- local socket = require "socket";
-- check and parse the dbFile and the method algorithm
-- Create a new ip2region object by the new interface
local ip2region = Ip2region.new(arg[1]);
-- reset the dbFile by the follow two ways:
-- ip2region.dbFile = arg[1];
-- ip2region:setDbFile(arg[1]);
local algorithm = "btree";
if ( arg[2] ~= nil ) then
local arg_2 = string.lower(arg[2]);
if ( arg_2 ~= "binary" and arg_2 ~= "memory" ) then
algorithm = "binary";
elseif ( arg_2 == "memory" ) then
algorithm = "memory";
end
end
-- local data = searcher:memorySearch("120.79.17.142");
-- local data = searcher:binarySearch("120.79.17.142");
-- local data = searcher:btreeSearch("120.79.17.142");
print("initializing " .. algorithm ..[[
+----------------------------------+
| ip2region test script |
| Author: chenxin619315@gmail.com |
| Type 'quit' to exit program |
+----------------------------------+]]
);
while ( true ) do
io.write("ip2region>> ");
io.input(io.stdin);
local line = io.read();
if ( line == nil ) then
-- do nothing
break;
elseif ( line == "quit" ) then
break;
elseif ( ip2region.ip2long(line) == nil ) then
print("Invalid ip address=", line);
else
local data;
local s_time = os.clock();
if ( algorithm == "btree" ) then
data = ip2region:btreeSearch(line);
elseif ( algorithm == "binary" ) then
data = ip2region:binarySearch(line);
elseif ( algorithm == "memory" ) then
data = ip2region:memorySearch(line);
end
local cost_time = (os.clock() - s_time) * 1000; -- to millseconds
if ( data == nil ) then
io.write("Failed for ip=", line, " is it a valid ip address ?");
else
io.write(string.format("%u|%s in %5f millseconds\n", data.city_id, data.region, cost_time));
end
end
end
-- close the object
-- print(ip2region);
ip2region:close();
| apache-2.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c40867519.lua | 6 | 1840 | --静寂虫
function c40867519.initial_effect(c)
--to defense
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(40867519,0))
e1:SetCategory(CATEGORY_POSITION)
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c40867519.postg)
e1:SetOperation(c40867519.posop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e2)
--disable
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DISABLE)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE)
e3:SetTarget(c40867519.distarget)
c:RegisterEffect(e3)
--disable effect
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_CHAIN_SOLVING)
e4:SetRange(LOCATION_MZONE)
e4:SetOperation(c40867519.disop)
c:RegisterEffect(e4)
--disable trap monster
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e5:SetRange(LOCATION_MZONE)
e5:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e5:SetTarget(c40867519.distarget)
c:RegisterEffect(e5)
end
function c40867519.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return e:GetHandler():IsAttackPos() end
Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,0,0)
end
function c40867519.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsAttackPos() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENSE)
end
end
function c40867519.distarget(e,c)
return c~=e:GetHandler() and c:IsType(TYPE_CONTINUOUS)
end
function c40867519.disop(e,tp,eg,ep,ev,re,r,rp)
local tl=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)
if tl==LOCATION_SZONE and re:IsActiveType(TYPE_CONTINUOUS) then
Duel.NegateEffect(ev)
end
end
| gpl-2.0 |
Turttle/darkstar | scripts/globals/items/bowl_of_vegetable_broth.lua | 35 | 1399 | -----------------------------------------
-- ID: 4323
-- Item: bowl_of_vegetable_broth
-- Food Effect: 4Hrs, All Races
-----------------------------------------
-- Vitality -1
-- Agility 5
-- Ranged Accuracy 6
-- HP Recovered While Healing 3
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,14400,4323);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_VIT, -1);
target:addMod(MOD_AGI, 5);
target:addMod(MOD_RACC, 6);
target:addMod(MOD_HPHEAL, 3);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_VIT, -1);
target:delMod(MOD_AGI, 5);
target:delMod(MOD_RACC, 6);
target:delMod(MOD_HPHEAL, 3);
end;
| gpl-3.0 |
dickeyf/darkstar | scripts/zones/Chamber_of_Oracles/TextIDs.lua | 15 | 1386 | -- Variable TextID Description text
-- General Texts
ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item> come back again after sorting your inventory
ITEM_OBTAINED = 6384; -- Obtained: <item>
GIL_OBTAINED = 6385; -- Obtained <number> gil
KEYITEM_OBTAINED = 6387; -- Obtained key item: <keyitem>
-- Other Texts
YOU_CANNOT_ENTER_THE_BATTLEFIELD = 7206; -- You cannot enter the battlefield at present. Please wait a little longer.
-- Mission Texts
PLACED_INTO_THE_PEDESTAL = 7610; -- It appears that something should be placed into this pedestal.
YOU_PLACE_THE = 7611; -- You place theinto the pedestal.
IS_SET_IN_THE_PEDESTAL = 7612; -- Theis set in the pedestal.
HAS_LOST_ITS_POWER = 7613; -- Thehas lost its power.
-- Maat dialog
YOU_DECIDED_TO_SHOW_UP = 7632; -- So, you decided to show up.
LOOKS_LIKE_YOU_WERENT_READY = 7633; -- Looks like you weren't ready for me, were you?
YOUVE_COME_A_LONG_WAY = 7634; -- Hm. That was a mighty fine display of skill there, Player Name. You've come a long way...
TEACH_YOU_TO_RESPECT_ELDERS = 7635; -- I'll teach you to respect your elders!
TAKE_THAT_YOU_WHIPPERSNAPPER = 7636; -- Take that, you whippersnapper!
THAT_LL_HURT_IN_THE_MORNING = 7638; -- Ungh... That'll hurt in the morning...
-- conquest Base
CONQUEST_BASE = 7045; -- Tallying conquest results...
| gpl-3.0 |
fgenesis/Aquaria_experimental | game_scripts/scripts/entities/bigblaster.lua | 6 | 6334 | -- Copyright (C) 2007, 2010 - Bit-Blot
--
-- This file is part of Aquaria.
--
-- Aquaria is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; either version 2
-- of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
-- See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
if not v then v = {} end
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
-- ================================================================================================
-- B L A S T E R
-- ================================================================================================
-- entity specific
local STATE_FIRE = 1000
local STATE_PULLBACK = 1001
local STATE_WAITING = 1002
v.fireDelay = 0
v.motherChance = 10
v.soundDelay = 0
v.shotsFired = 0
v.n = 0
-- ================================================================================================
-- FUNCTIONS
-- ================================================================================================
function init(me)
setupBasicEntity(
me,
"", -- texture
100, -- health
1, -- manaballamount
1, -- exp
1, -- money
48, -- collideRadius (only used if hit entities is on)
STATE_WAITING, -- initState
128, -- sprite width
128, -- sprite height
1, -- particle "explosion" type, maps to particleEffects.txt -1 = none
0, -- 0/1 hit other entities off/on (uses collideRadius)
2000 -- updateCull -1: disabled, default: 4000
)
entity_initSkeletal(me, "BigBlaster")
entity_animate(me, "idle", -1)
entity_setDeathParticleEffect(me, "Explode")
entity_scale(me, 1.2, 1.2)
v.soundDelay = math.random(3)+1
entity_setEatType(me, EAT_FILE, "Blaster")
entity_setDeathScene(me, true)
loadSound("BossDieSmall")
loadSound("BossDieBig")
loadSound("BigBlasterRoar")
loadSound("BigBlasterLaugh")
entity_setDamageTarget(me, DT_AVATAR_PET, false)
end
function postInit(me)
v.n = getNaija()
if isFlag(FLAG_PET_BLASTER, 1) then
entity_delete(me)
end
end
function update(me, dt)
if entity_isState(me, STATE_WAITING) then
if entity_isEntityInRange(me, getNaija(), 2000) then
playSfx("BigBlasterLaugh")
shakeCamera(2, 3)
entity_setState(me, STATE_IDLE)
end
return
end
if true then
if entity_hasTarget(me) then
if entity_isTargetInRange(me, 200) then
entity_moveTowardsTarget(me, dt, -200)
end
if entity_isTargetInRange(me, 64) then
-- entity_hurtTarget(1);
entity_moveTowardsTarget(me, dt, -1000)
end
end
if v.fireDelay > 0 then
v.fireDelay = v.fireDelay - dt
if v.fireDelay < 0 then
v.fireDelay = 0
end
end
if entity_getState(me)==STATE_IDLE then
if not entity_hasTarget(me) then
entity_findTarget(me, 1000)
else
if entity_isTargetInRange(me, 1600) then
entity_moveTowardsTarget(me, dt, 400) -- move in if we're too far away
if entity_isTargetInRange(me, 350) and v.fireDelay==0 then
entity_setState(me, STATE_FIRE)
end
end
end
v.soundDelay = v.soundDelay - dt
if v.soundDelay < 0 then
-- Sound doesn't exist, so commenting out. --achurch
--entity_playSfx(me, "BlasterIdle")
v.soundDelay = math.random(3)+1
end
end
if entity_getState(me)==STATE_FIRE then
entity_moveTowardsTarget(me, dt, -600)
end
if entity_getState(me)==STATE_PULLBACK then
if not entity_hasTarget(me) then
entity_setState(me, STATE_IDLE)
else
if entity_isTargetInRange(me, 800) then
entity_moveTowardsTarget(me, dt, -5000)
else
entity_setState(me, STATE_IDLE)
end
end
end
end
entity_doEntityAvoidance(me, dt, 256, 0.2)
-- entity_doSpellAvoidance(dt, 200, 1.5);
entity_doCollisionAvoidance(me, dt, 6, 0.5)
entity_rotateToVel(me, 0.1)
entity_updateCurrents(me, dt)
entity_updateMovement(me, dt)
entity_handleShotCollisions(me)
entity_touchAvatarDamage(me, 32, 0, 1000)
end
function enterState(me)
if entity_getState(me)==STATE_IDLE then
v.fireDelay = 1
entity_setMaxSpeed(me, 600)
elseif entity_getState(me)==STATE_FIRE then
entity_setStateTime(me, 0.2)
entity_setMaxSpeed(me, 800)
local s = createShot("BigBlasterFire", me, entity_getTarget(me))
shot_setOut(s, 32)
elseif entity_getState(me)==STATE_PULLBACK then
if chance(50) then
shakeCamera(2, 3)
playSfx("BigBlasterRoar")
end
entity_setMaxSpeed(me, 900)
elseif entity_isState(me, STATE_DEATHSCENE) then
clearShots()
entity_setStateTime(me, 99)
debugLog("spawning egg")
entity_setInvincible(v.n, true)
entity_idle(v.n)
cam_toEntity(me)
entity_setInternalOffset(me, 0, 0)
entity_setInternalOffset(me, 0, 10, 0.1, -1)
playSfx("BossDieSmall")
entity_idle(v.n)
fade(1, 0.5, 1, 1, 1)
watch(0.5)
fade(0, 1, 1, 1, 1)
watch(0.5)
playSfx("BigBlasterLaugh")
watch(0.7)
entity_color(me, 1, 0, 0, 2)
watch(1.0)
playSfx("BigBlasterRoar")
watch(0.5)
playSfx("BossDieBig")
fade(1, 0.2, 1, 1, 1)
watch(0.2)
watch(0.5)
fade(0, 1, 1, 1, 1)
local node = getNode("EGGLOC")
debugLog(string.format("node(%d, %d", node_x(node), node_y(node)))
local e = createEntity("CollectibleBlasterEgg", "", node_x(node), node_y(node))
cam_toEntity(e)
watch(3)
cam_toEntity(getNaija())
entity_setState(me, STATE_DEAD, -1, 1)
end
end
function exitState(me)
if entity_getState(me)==STATE_FIRE then
v.shotsFired = v.shotsFired + 1
if v.shotsFired < 8 then
entity_setState(me, STATE_FIRE)
else
entity_setState(me, STATE_PULLBACK, 1)
end
elseif entity_getState(me)==STATE_PULLBACK then
v.shotsFired = 0
entity_setState(me, STATE_IDLE)
end
end
function hitSurface(me)
end
function damage(me, attacker, bone, damageType, dmg)
if damageType == DT_AVATAR_BITE then
entity_changeHealth(me, -99)
end
return true
end
| gpl-2.0 |
dickeyf/darkstar | scripts/globals/items/dish_of_spaghetti_arrabbiata_+1.lua | 18 | 1754 | -----------------------------------------
-- ID: 5212
-- Item: dish_of_spaghetti_arrabbiata_+1
-- Food Effect: 60Min, All Races
-----------------------------------------
-- Health % 15
-- Health Cap 150
-- Strength 5
-- Vitality 2
-- Intelligence -7
-- Attack % 22
-- Attack Cap 120
-- Store TP 5
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
local result = 0;
if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then
result = 246;
end
return result;
end;
-----------------------------------------
-- OnItemUse
-----------------------------------------
function onItemUse(target)
target:addStatusEffect(EFFECT_FOOD,0,0,3600,5212);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_FOOD_HPP, 15);
target:addMod(MOD_FOOD_HP_CAP, 150);
target:addMod(MOD_STR, 5);
target:addMod(MOD_VIT, 2);
target:addMod(MOD_INT, -7);
target:addMod(MOD_FOOD_ATTP, 22);
target:addMod(MOD_FOOD_ATT_CAP, 120);
target:addMod(MOD_STORETP, 5);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_FOOD_HPP, 15);
target:delMod(MOD_FOOD_HP_CAP, 150);
target:delMod(MOD_STR, 5);
target:delMod(MOD_VIT, 2);
target:delMod(MOD_INT, -7);
target:delMod(MOD_FOOD_ATTP, 22);
target:delMod(MOD_FOOD_ATT_CAP, 120);
target:delMod(MOD_STORETP, 5);
end;
| gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c66451379.lua | 5 | 2854 | --グレイドル・アリゲーター
function c66451379.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c66451379.eqcon)
e1:SetTarget(c66451379.eqtg)
e1:SetOperation(c66451379.eqop)
c:RegisterEffect(e1)
end
function c66451379.eqcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return (c:IsReason(REASON_BATTLE) or (c:IsReason(REASON_EFFECT) and re:IsActiveType(TYPE_SPELL)))
and c:IsReason(REASON_DESTROY) and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE)
end
function c66451379.eqtg(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:IsFaceup() end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
end
function c66451379.eqlimit(e,c)
return c==e:GetLabelObject()
end
function c66451379.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsControler(1-tp) then
Duel.Equip(tp,c,tc,true)
--Add Equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c66451379.eqlimit)
e1:SetLabelObject(tc)
c:RegisterEffect(e1)
--control
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_SET_CONTROL)
e2:SetValue(tp)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
--Destroy
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EVENT_LEAVE_FIELD_P)
e3:SetOperation(c66451379.checkop)
e3:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetOperation(c66451379.desop)
e4:SetReset(RESET_EVENT+0x17e0000)
e4:SetLabelObject(e3)
c:RegisterEffect(e4)
end
end
function c66451379.checkop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsDisabled() then
e:SetLabel(1)
else e:SetLabel(0) end
end
function c66451379.desop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabelObject():GetLabel()~=0 then return end
local tc=e:GetHandler():GetEquipTarget()
if tc and tc:IsLocation(LOCATION_MZONE) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
dickeyf/darkstar | scripts/zones/Temenos/mobs/Cryptonberry_Charmer.lua | 7 | 1128 | -----------------------------------
-- Area: Temenos N T
-- NPC: Cryptonberry_Charmer
-----------------------------------
package.loaded["scripts/zones/Temenos/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/limbus");
require("scripts/zones/Temenos/TextIDs");
-----------------------------------
-- onMobSpawn Action
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer,ally)
if (IsMobDead(16928816)==true and IsMobDead(16928817)==true ) then
GetNPCByID(16928768+38):setPos(-412,-78,426);
GetNPCByID(16928768+38):setStatus(STATUS_NORMAL);
GetNPCByID(16928768+172):setPos(-415,-78,427);
GetNPCByID(16928768+172):setStatus(STATUS_NORMAL);
GetNPCByID(16928768+214):setPos(-412,-78,422);
GetNPCByID(16928768+214):setStatus(STATUS_NORMAL);
GetNPCByID(16928770+455):setStatus(STATUS_NORMAL);
end
end;
| gpl-3.0 |
SalvationDevelopment/Salvation-Scripts-TCG | c80352158.lua | 2 | 1255 | --マグネット・リバース
function c80352158.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c80352158.target)
e1:SetOperation(c80352158.activate)
c:RegisterEffect(e1)
end
function c80352158.filter(c,e,tp)
return c:IsRace(RACE_MACHINE+RACE_ROCK) and not c:IsSummonableCard()
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c80352158.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and c80352158.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c80352158.filter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c80352158.filter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c80352158.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.