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 |
|---|---|---|---|---|---|
mercury233/ygopro-scripts | c4694209.lua | 2 | 2873 | --カードガード
function c4694209.initial_effect(c)
--summon success
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(4694209,0))
e1:SetCategory(CATEGORY_COUNTER)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c4694209.addct)
e1:SetOperation(c4694209.addc)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--attackup
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(c4694209.attackup)
c:RegisterEffect(e3)
--destroy rep
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(4694209,1))
e4:SetCategory(CATEGORY_COUNTER)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetCountLimit(1)
e4:SetRange(LOCATION_MZONE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetCost(c4694209.addccost2)
e4:SetTarget(c4694209.addct2)
e4:SetOperation(c4694209.addc2)
c:RegisterEffect(e4)
end
function c4694209.addct(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,1,0,0x1021)
end
function c4694209.addc(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
e:GetHandler():AddCounter(0x1021,1)
end
end
function c4694209.attackup(e,c)
return c:GetCounter(0x1021)*300
end
function c4694209.addccost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x1021,1,REASON_COST) end
e:GetHandler():RemoveCounter(tp,0x1021,1,REASON_COST)
end
function c4694209.addct2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc:IsCanAddCounter(0x1021,1) end
if chk==0 then return Duel.IsExistingTarget(Card.IsCanAddCounter,tp,LOCATION_ONFIELD,0,1,e:GetHandler(),0x1021,1) end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(4694209,1))
Duel.SelectTarget(tp,Card.IsCanAddCounter,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler(),0x1021,1)
end
function c4694209.addc2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
tc:AddCounter(0x1021,1)
if tc:GetFlagEffect(4694209)~=0 then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EFFECT_DESTROY_REPLACE)
e1:SetTarget(c4694209.reptg)
e1:SetOperation(c4694209.repop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
tc:RegisterFlagEffect(4694209,RESET_EVENT+RESETS_STANDARD,0,0)
end
end
function c4694209.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsReason(REASON_RULE) and e:GetHandler():GetCounter(0x1021)>0 end
return true
end
function c4694209.repop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RemoveCounter(tp,0x1021,1,REASON_EFFECT)
end
| gpl-2.0 |
qq779089973/my_openwrt_mod | luci/applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/smap_devinfo_mini.lua | 141 | 1031 | --[[
smap_devinfo - SIP Device Information
(c) 2009 Daniel Dickinson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
require("luci.i18n")
require("luci.util")
require("luci.sys")
require("luci.model.uci")
require("luci.controller.luci_diag.smap_common")
require("luci.controller.luci_diag.devinfo_common")
local debug = false
m = SimpleForm("luci-smap-to-devinfo", translate("Phone Information"), translate("Scan for supported SIP devices on specified networks."))
m.reset = false
m.submit = false
local outnets = luci.controller.luci_diag.smap_common.get_params()
luci.controller.luci_diag.devinfo_common.run_processes(outnets, luci.controller.luci_diag.smap_common.command_function)
luci.controller.luci_diag.devinfo_common.parse_output(m, outnets, true, "smap", true, debug)
luci.controller.luci_diag.smap_common.action_links(m, true)
return m
| mit |
Zenny89/darkstar | scripts/globals/spells/huton_san.lua | 17 | 1612 | -----------------------------------------
-- Spell: Huton: San
-- Deals wind damage to an enemy and lowers its resistance against ice.
-----------------------------------------
require("scripts/globals/status");
require("scripts/globals/magic");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
--doNinjutsuNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus)
local duration = 15 + caster:getMerit(MERIT_HUTON_EFFECT) -- T1 bonus debuff duration
local bonusAcc = 0;
local bonusMab = caster:getMerit(MERIT_HUTON_EFFECT) + caster:getMod(MOD_NIN_NUKE_BONUS); -- T1 mag atk + "enhances Ninjustu damage" mod
if(caster:getMerit(MERIT_HUTON_SAN) ~= 0) then -- T2 mag atk/mag acc, don't want to give a penalty to entities that can cast this without merits
bonusMab = bonusMab + caster:getMerit(MERIT_HUTON_SAN) - 5; -- merit gives 5 power but no bonus with one invest, thus subtract 5
bonusAcc = bonusAcc + caster:getMerit(MERIT_HUTON_SAN) - 5;
end;
if (caster:isBehind(target,15) and caster:hasStatusEffect(EFFECT_INNIN)) then -- Innin mag atk bonus from behind, guesstimating angle at 15 degrees
bonusMab = bonusMab + caster:getStatusEffect(EFFECT_INNIN):getPower();
end
local dmg = doNinjutsuNuke(134,1,caster,spell,target,false,bonusAcc,bonusMab);
handleNinjutsuDebuff(caster,target,spell,30,duration,MOD_ICERES);
return dmg;
end; | gpl-3.0 |
Zenny89/darkstar | scripts/zones/Qufim_Island/npcs/Jiwon.lua | 17 | 1862 | -----------------------------------
-- Area: Qufim Island
-- NPC: Jiwon
-- Type: Outpost Vendor
-- @pos -249 -19 300 126
-----------------------------------
package.loaded["scripts/zones/Qufim_Island/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/globals/conquest");
require("scripts/zones/Qufim_Island/TextIDs");
local region = QUFIMISLAND;
local csid = 0x7ff4;
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local owner = GetRegionOwner(region);
local arg1 = getArg1(owner,player);
if (owner == player:getNation()) then
nation = 1;
elseif (arg1 < 1792) then
nation = 2;
else
nation = 0;
end
player:startEvent(csid,nation,OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP(),0,0,0);
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
player:updateEvent(player:getGil(),OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP());
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
--printf("CSID: %u",csid);
--printf("OPTION: %u",option);
if (option == 1) then
ShowOPVendorShop(player);
elseif (option == 2) then
if (player:delGil(OP_TeleFee(player,region))) then
toHomeNation(player);
end
elseif (option == 6) then
player:delCP(OP_TeleFee(player,region));
toHomeNation(player);
end
end; | gpl-3.0 |
mercury233/ygopro-scripts | c91279700.lua | 3 | 1805 | --ヴェルズ・オピオン
function c91279700.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0xa),4,2)
c:EnableReviveLimit()
--disable spsummon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetTarget(c91279700.sumlimit)
e1:SetCondition(c91279700.dscon)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(91279700,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c91279700.cost)
e2:SetTarget(c91279700.target)
e2:SetOperation(c91279700.operation)
c:RegisterEffect(e2)
end
function c91279700.dscon(e)
return e:GetHandler():GetOverlayCount()~=0
end
function c91279700.sumlimit(e,c,sump,sumtype,sumpos,targetp)
return c:IsLevelAbove(5)
end
function c91279700.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 c91279700.filter(c)
return c:IsSetCard(0x65) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function c91279700.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c91279700.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c91279700.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c91279700.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
| gpl-2.0 |
mercury233/ygopro-scripts | c16719140.lua | 2 | 3840 | --サブテラーの戦士
function c16719140.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(16719140,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,16719140)
e1:SetCost(c16719140.spcost)
e1:SetTarget(c16719140.sptg1)
e1:SetOperation(c16719140.spop1)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(16719140,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_FLIP)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,16719141)
e2:SetCondition(c16719140.spcon)
e2:SetTarget(c16719140.sptg2)
e2:SetOperation(c16719140.spop2)
c:RegisterEffect(e2)
end
function c16719140.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100)
if chk==0 then return true end
end
function c16719140.costfilter(c,e,tp,mg,rlv,mc)
if not (c:IsLevelAbove(0) and c:IsSetCard(0xed) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_DEFENSE)) then return false end
return mg:CheckSubGroup(c16719140.fselect,1,c:GetLevel(),tp,c:GetLevel()-rlv,mc)
end
function c16719140.fselect(g,tp,lv,mc)
local mg=g:Clone()
mg:AddCard(mc)
if Duel.GetMZoneCount(tp,mg)>0 then
if lv<=0 then
return g:GetCount()==1
else
Duel.SetSelectedCard(g)
return g:CheckWithSumGreater(Card.GetOriginalLevel,lv)
end
else return false end
end
function c16719140.relfilter(c)
return c:IsLevelAbove(1) and c:IsReleasableByEffect()
end
function c16719140.sptg1(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local mg=Duel.GetReleaseGroup(tp):Filter(c16719140.relfilter,c)
if chk==0 then
if e:GetLabel()~=100 then return false end
e:SetLabel(0)
if not c:IsLevelAbove(1) or not c:IsReleasableByEffect() or mg:GetCount()==0 then return false end
return Duel.IsExistingMatchingCard(c16719140.costfilter,tp,LOCATION_DECK,0,1,nil,e,tp,mg,c:GetOriginalLevel(),c)
end
e:SetLabel(0)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c16719140.costfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,mg,c:GetOriginalLevel(),c)
Duel.SendtoGrave(g,REASON_COST)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function c16719140.spop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if not c:IsRelateToEffect(e) or not tc:IsRelateToEffect(e) then return end
local mg=Duel.GetReleaseGroup(tp):Filter(c16719140.relfilter,c)
if mg:GetCount()==0 then return end
if aux.NecroValleyFilter()(tc) and tc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_DEFENSE) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=mg:SelectSubGroup(tp,c16719140.fselect,false,1,tc:GetLevel(),tp,tc:GetLevel()-c:GetOriginalLevel(),c)
if g and g:GetCount()>0 then
g:AddCard(c)
if Duel.Release(g,REASON_EFFECT)~=0 then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_DEFENSE)
if tc:IsFacedown() then
Duel.ConfirmCards(1-tp,tc)
end
end
end
end
end
function c16719140.cfilter(c,tp)
return c:IsSetCard(0x10ed) and c:IsControler(tp)
end
function c16719140.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c16719140.cfilter,1,nil,tp)
end
function c16719140.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 c16719140.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 |
mercury233/ygopro-scripts | c34116027.lua | 6 | 1396 | --ドラグニティナイト-ガジャルグ
function c34116027.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_DRAGON),aux.NonTuner(Card.IsRace,RACE_WINDBEAST),1)
c:EnableReviveLimit()
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(34116027,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_HANDES)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c34116027.target)
e1:SetOperation(c34116027.operation)
c:RegisterEffect(e1)
end
function c34116027.filter(c)
return c:IsLevelBelow(4) and c:IsRace(RACE_DRAGON+RACE_WINDBEAST) and c:IsAbleToHand()
end
function c34116027.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c34116027.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,1,tp,1)
end
function c34116027.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c34116027.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()==0 then return end
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleHand(tp)
Duel.BreakEffect()
Duel.DiscardHand(tp,Card.IsRace,1,1,REASON_EFFECT+REASON_DISCARD,nil,RACE_DRAGON+RACE_WINDBEAST)
end
| gpl-2.0 |
SuperAwesomeLTD/thrift | test/lua/test_basic_client.lua | 57 | 7626 | -- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
-- http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
require('TSocket')
require('TBinaryProtocol')
require('ThriftTest_ThriftTest')
require('liblualongnumber')
local client
function teardown()
if client then
-- Shuts down the server
client:testVoid()
-- close the connection
client:close()
end
end
function assertEqual(val1, val2, msg)
assert(val1 == val2, msg)
end
function testBasicClient()
local socket = TSocket:new{
port = 9090
}
assert(socket, 'Failed to create client socket')
socket:setTimeout(5000)
local protocol = TBinaryProtocol:new{
trans = socket
}
assert(protocol, 'Failed to create binary protocol')
client = ThriftTestClient:new{
protocol = protocol
}
assert(client, 'Failed to create client')
-- Open the socket
local status, _ = pcall(socket.open, socket)
assert(status, 'Failed to connect to server')
-- String
assertEqual(client:testString('lala'), 'lala', 'Failed testString')
assertEqual(client:testString('wahoo'), 'wahoo', 'Failed testString')
-- Byte
assertEqual(client:testByte(0x01), 1, 'Failed testByte 1')
assertEqual(client:testByte(0x40), 64, 'Failed testByte 2')
assertEqual(client:testByte(0x7f), 127, 'Failed testByte 3')
assertEqual(client:testByte(0x80), -128, 'Failed testByte 4')
assertEqual(client:testByte(0xbf), -65, 'Failed testByte 5')
assertEqual(client:testByte(0xff), -1, 'Failed testByte 6')
assertEqual(client:testByte(128), -128, 'Failed testByte 7')
assertEqual(client:testByte(255), -1, 'Failed testByte 8')
-- I32
assertEqual(client:testI32(0x00000001), 1, 'Failed testI32 1')
assertEqual(client:testI32(0x40000000), 1073741824, 'Failed testI32 2')
assertEqual(client:testI32(0x7fffffff), 2147483647, 'Failed testI32 3')
assertEqual(client:testI32(0x80000000), -2147483648, 'Failed testI32 4')
assertEqual(client:testI32(0xbfffffff), -1073741825, 'Failed testI32 5')
assertEqual(client:testI32(0xffffffff), -1, 'Failed testI32 6')
assertEqual(client:testI32(2147483648), -2147483648, 'Failed testI32 7')
assertEqual(client:testI32(4294967295), -1, 'Failed testI32 8')
-- I64 (lua only supports 16 decimal precision so larger numbers are
-- initialized by their string value)
local long = liblualongnumber.new
assertEqual(client:testI64(long(0x0000000000000001)),
long(1),
'Failed testI64 1')
assertEqual(client:testI64(long(0x4000000000000000)),
long(4611686018427387904),
'Failed testI64 2')
assertEqual(client:testI64(long('0x7fffffffffffffff')),
long('9223372036854775807'),
'Failed testI64 3')
assertEqual(client:testI64(long(0x8000000000000000)),
long(-9223372036854775808),
'Failed testI64 4')
assertEqual(client:testI64(long('0xbfffffffffffffff')),
long('-4611686018427387905'),
'Failed testI64 5')
assertEqual(client:testI64(long('0xffffffffffffffff')),
long(-1),
'Failed testI64 6')
-- Double
assertEqual(
client:testDouble(1.23456789), 1.23456789, 'Failed testDouble 1')
assertEqual(
client:testDouble(0.123456789), 0.123456789, 'Failed testDouble 2')
assertEqual(
client:testDouble(0.123456789), 0.123456789, 'Failed testDouble 3')
-- TODO testBinary() ...
-- Accuracy of 16 decimal digits (rounds)
local a, b = 1.12345678906666663, 1.12345678906666661
assertEqual(a, b)
assertEqual(client:testDouble(a), b, 'Failed testDouble 5')
-- Struct
local a = {
string_thing = 'Zero',
byte_thing = 1,
i32_thing = -3,
i64_thing = long(-5)
}
-- TODO fix client struct equality
--assertEqual(client:testStruct(a), a, 'Failed testStruct')
-- Call the void function and end the test (handler stops server)
client:testVoid()
end
testBasicClient()
teardown() | apache-2.0 |
mercury233/ygopro-scripts | c85651167.lua | 4 | 2793 | --真紅眼の鉄騎士-ギア・フリード
function c85651167.initial_effect(c)
--destroy equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(85651167,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_EQUIP)
e1:SetCountLimit(1)
e1:SetTarget(c85651167.destg)
e1:SetOperation(c85651167.desop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(85651167,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(c85651167.spcost)
e2:SetTarget(c85651167.sptg)
e2:SetOperation(c85651167.spop)
c:RegisterEffect(e2)
end
function c85651167.filter1(c,ec)
return c:GetEquipTarget()==ec
end
function c85651167.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(c85651167.filter1,1,nil,e:GetHandler()) end
local g=eg:Filter(c85651167.filter1,nil,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c85651167.desop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(c85651167.filter1,nil,e:GetHandler())
local sg=Duel.GetMatchingGroup(Card.IsType,tp,0,LOCATION_ONFIELD,nil,TYPE_SPELL+TYPE_TRAP)
if Duel.Destroy(g,REASON_EFFECT)~=0 and sg:GetCount()>0
and Duel.SelectYesNo(tp,aux.Stringid(85651167,2)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local tg=sg:Select(tp,1,1,nil)
Duel.HintSelection(tg)
Duel.Destroy(tg,REASON_EFFECT)
end
end
function c85651167.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetEquipGroup():IsExists(Card.IsAbleToGraveAsCost,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=e:GetHandler():GetEquipGroup():FilterSelect(tp,Card.IsAbleToGraveAsCost,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c85651167.spfilter(c,e,tp)
return c:IsSetCard(0x3b) and c:IsLevelBelow(7) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c85651167.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c85651167.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c85651167.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c85651167.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c85651167.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 |
mercury233/ygopro-scripts | c20773176.lua | 2 | 1913 | --炎獣の影霊衣-セフィラエグザ
function c20773176.initial_effect(c)
--pendulum summon
aux.EnablePendulumAttribute(c)
--splimit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_PZONE)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e2:SetTargetRange(1,0)
e2:SetTarget(c20773176.splimit)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e3:SetCode(EVENT_DESTROYED)
e3:SetCountLimit(1,20773176)
e3:SetCondition(c20773176.condition)
e3:SetTarget(c20773176.target)
e3:SetOperation(c20773176.operation)
c:RegisterEffect(e3)
end
function c20773176.splimit(e,c,sump,sumtype,sumpos,targetp)
if c:IsSetCard(0xb4,0xc4) then return false end
return bit.band(sumtype,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM
end
function c20773176.filter(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT)
and c:IsSetCard(0xb4,0xc4) and not c:IsCode(20773176)
and c:IsPreviousControler(tp)
and ((c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP))
or c:IsPreviousLocation(LOCATION_PZONE))
end
function c20773176.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c20773176.filter,1,nil,tp)
end
function c20773176.target(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 c20773176.operation(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,false,false,POS_FACEUP)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c62803464.lua | 1 | 3276 | --地霊媒師アウス
function c62803464.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,62803464)
e1:SetCost(c62803464.srcost)
e1:SetTarget(c62803464.srtg)
e1:SetOperation(c62803464.srop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BATTLE_DESTROYED)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,62803465)
e2:SetCondition(c62803464.spcon)
e2:SetTarget(c62803464.sptg)
e2:SetOperation(c62803464.spop)
c:RegisterEffect(e2)
end
function c62803464.filter(c,sc,tp)
if not (c:IsAttribute(ATTRIBUTE_EARTH) and c:IsDiscardable()) then return false end
local race=c:GetOriginalRace()|sc:GetOriginalRace()
return Duel.IsExistingMatchingCard(c62803464.srfilter,tp,LOCATION_DECK,0,1,nil,race)
end
function c62803464.srfilter(c,race)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsAttackBelow(1850) and c:IsAbleToHand()
and c:GetOriginalRace()&race>0
end
function c62803464.srcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(100)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(c62803464.filter,tp,LOCATION_HAND,0,1,c,c,tp) and c:IsDiscardable() end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,c62803464.filter,tp,LOCATION_HAND,0,1,1,c,c,tp)
e:SetLabelObject(g:GetFirst())
g:AddCard(c)
Duel.SendtoGrave(g,REASON_COST+REASON_DISCARD)
end
function c62803464.srtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local res=e:GetLabel()==100
e:SetLabel(0)
return res
end
e:SetLabel(0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c62803464.srop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local sc=e:GetLabelObject()
local race=c:GetOriginalRace()|sc:GetOriginalRace()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c62803464.srfilter,tp,LOCATION_DECK,0,1,1,nil,race)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(c62803464.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c62803464.aclimit(e,re,tp)
return re:IsActiveType(TYPE_MONSTER) and not re:GetHandler():IsAttribute(ATTRIBUTE_EARTH)
end
function c62803464.cfilter(c,tp)
return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp)
and bit.band(c:GetPreviousAttributeOnField(),ATTRIBUTE_EARTH)~=0
end
function c62803464.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c62803464.cfilter,1,nil,tp)
end
function c62803464.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function c62803464.spop(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 |
mercury233/ygopro-scripts | c1322368.lua | 2 | 2170 | --SPYRAL-ザ・ダブルヘリックス
function c1322368.initial_effect(c)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkSetCard,0xee),2,2)
--change name
aux.EnableChangeCode(c,41091257,LOCATION_MZONE+LOCATION_GRAVE)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(1322368,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,1322368)
e2:SetTarget(c1322368.sptg)
e2:SetOperation(c1322368.spop)
c:RegisterEffect(e2)
end
function c1322368.spfilter(c,e,tp,zone)
return c:IsSetCard(0xee) and c:IsType(TYPE_MONSTER) and (c:IsAbleToHand() or (zone~=0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone)))
end
function c1322368.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local zone=e:GetHandler():GetLinkedZone()
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)>0
and Duel.IsExistingMatchingCard(c1322368.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp,zone) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
e:SetLabel(Duel.AnnounceType(tp))
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c1322368.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)==0 then return end
Duel.ConfirmDecktop(1-tp,1)
local g=Duel.GetDecktopGroup(1-tp,1)
local tc=g:GetFirst()
local opt=e:GetLabel()
if (opt==0 and tc:IsType(TYPE_MONSTER)) or (opt==1 and tc:IsType(TYPE_SPELL)) or (opt==2 and tc:IsType(TYPE_TRAP)) then
local zone=e:GetHandler():GetLinkedZone(tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local sg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c1322368.spfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp,zone)
local sc=sg:GetFirst()
if sc then
if zone~=0 and sc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone)
and (not sc:IsAbleToHand() or Duel.SelectOption(tp,1190,1152)==1) then
Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP,zone)
else
Duel.SendtoHand(sc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sc)
end
end
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/globals/mobskills/Calcifying_Deluge.lua | 25 | 1064 | ---------------------------------------------
-- Calcifying Deluge
--
-- Description: Delivers a threefold ranged attack to targets in an area of effect. Additional effect: Petrification
-- Type: Physical
-- Utsusemi/Blink absorb: 2-3 shadows
-- Range: Unknown
-- Notes: Used only by Medusa.
---------------------------------------------
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 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_PIERCE,MOBPARAM_3_SHADOW);
target:delHP(dmg);
local typeEffect = EFFECT_PETRIFICATION;
MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, 1, 0, 120);
return dmg;
end;
| gpl-3.0 |
mercury233/ygopro-scripts | c73941492.lua | 2 | 4102 | --調弦の魔術師
function c73941492.initial_effect(c)
Duel.EnableGlobalFlag(GLOBALFLAG_TUNE_MAGICIAN)
--pendulum summon
aux.EnablePendulumAttribute(c)
--atk&def
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetRange(LOCATION_PZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetValue(c73941492.atkval)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e2)
--cannot special summon
local e3=Effect.CreateEffect(c)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetRange(LOCATION_EXTRA)
e3:SetCode(EFFECT_SPSUMMON_CONDITION)
e3:SetValue(aux.FALSE)
c:RegisterEffect(e3)
--synchro limit
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_TUNER_MATERIAL_LIMIT)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e4:SetTarget(c73941492.synlimit)
c:RegisterEffect(e4)
--fusion limit
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_TUNE_MAGICIAN_F)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e5:SetValue(c73941492.fuslimit)
c:RegisterEffect(e5)
--xyz limit
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_TUNE_MAGICIAN_X)
e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e6:SetValue(c73941492.xyzlimit)
c:RegisterEffect(e6)
--spsummon success
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(73941492,0))
e7:SetCategory(CATEGORY_SPECIAL_SUMMON)
e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e7:SetCode(EVENT_SPSUMMON_SUCCESS)
e7:SetCountLimit(1,73941492)
e7:SetCondition(c73941492.spcon)
e7:SetTarget(c73941492.sptg)
e7:SetOperation(c73941492.spop)
c:RegisterEffect(e7)
end
function c73941492.synlimit(e,c)
return c:IsSetCard(0x98) and c:IsType(TYPE_PENDULUM)
end
function c73941492.fuslimit(e,c)
return not (c:IsSetCard(0x98) and c:IsType(TYPE_PENDULUM))
end
function c73941492.xyzlimit(e,c)
return not (c:IsSetCard(0x98) and c:IsType(TYPE_PENDULUM))
end
function c73941492.atkfilter(c)
return c:IsFaceup() and c:IsSetCard(0x98) and c:IsType(TYPE_PENDULUM)
end
function c73941492.atkval(e,c)
local g=Duel.GetMatchingGroup(c73941492.atkfilter,c:GetControler(),LOCATION_EXTRA,0,nil)
return g:GetClassCount(Card.GetCode)*100
end
function c73941492.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsSummonType(SUMMON_TYPE_PENDULUM) and c:IsPreviousLocation(LOCATION_HAND)
end
function c73941492.spfilter(c,e,tp)
return c:IsSetCard(0x98) and c:IsType(TYPE_PENDULUM) and not c:IsCode(73941492)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c73941492.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c73941492.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c73941492.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,c73941492.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2,true)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetReset(RESET_EVENT+RESETS_REDIRECT)
e3:SetValue(LOCATION_REMOVED)
tc:RegisterEffect(e3,true)
end
Duel.SpecialSummonComplete()
end
| gpl-2.0 |
Cavitt/vanilla-ot | data/lib/033-ip.lua | 3 | 2463 | function doConvertIntegerToIp(int, mask)
local b = {
bit.urshift(bit.uband(int, 4278190080), 24),
bit.urshift(bit.uband(int, 16711680), 16),
bit.urshift(bit.uband(int, 65280), 8),
bit.urshift(bit.uband(int, 255), 0)
}
if(mask ~= nil) then
local m = {
bit.urshift(bit.uband(mask, 4278190080), 24),
bit.urshift(bit.uband(mask, 16711680), 16),
bit.urshift(bit.uband(mask, 65280), 8),
bit.urshift(bit.uband(mask, 255), 0)
}
if((m[1] == 255 or m[1] == 0) and (m[2] == 255 or m[2] == 0) and (m[3] == 255 or m[3] == 0) and (m[4] == 255 or m[4] == 0)) then
for i = 1, 4 do
if(m[i] == 0) then
b[i] = "*"
end
end
elseif(m[1] ~= 255 or m[2] ~= 255 or m[3] ~= 255 or m[4] ~= 255) then
return b[4] .. "." .. b[3] .. "." .. b[2] .. "." .. b[1] .. ":" .. m[4] .. "." .. m[3] .. "." .. m[2] .. "." .. m[1]
end
end
return b[4] .. "." .. b[3] .. "." .. b[2] .. "." .. b[1]
end
function doConvertIpToInteger(str)
local maskIndex = str:find(":")
if(maskIndex == nil) then
local ip, mask, index = 0, 0, 24
for b in str:gmatch("([x%d]+)%.?") do
if(b ~= "x") then
if(b:find("x") ~= nil) then
return 0, 0
end
local t = tonumber(b)
if(t == nil or t > 255 or t < 0) then
return 0, 0
end
mask = bit.ubor(mask, bit.ulshift(255, index))
ip = bit.ubor(ip, bit.ulshift(b, index))
end
index = index - 8
if(index < 0) then
break
end
end
if(index ~= -8) then
return 0, 0
end
return ip, mask
end
if(maskIndex <= 1) then
return 0, 0
end
local ipString, maskString, ip, mask, index = str:sub(1, maskIndex - 1), str:sub(maskIndex), 0, 0, 0
for b in ipString:gmatch("(%d+).?") do
local t = tonumber(b)
if(t == nil or t > 255 or t < 0) then
return 0, 0
end
ip = bit.ubor(ip, bit.ulshift(b, index))
index = index + 8
if(index > 24) then
break
end
end
if(index ~= 32) then
return 0, 0
end
index = 0
for b in maskString:gmatch("(%d+)%.?") do
local t = tonumber(b)
if(t == nil or t > 255 or t < 0) then
return 0, 0
end
mask = bit.ubor(mask, bit.ulshift(b, index))
index = index + 8
if(index > 24) then
break
end
end
if(index ~= 32) then
return 0, 0
end
return ip, mask
end
function doRevertIp(str)
local i, ip = 4, {}
for b in str:gmatch("(%d+).?") do
ip[i] = b
i = i - 1
end
if(not ip[1] or not ip[2] or not ip[3] or not ip[4]) then
return nil
end
return table.concat(ip, ".")
end
| agpl-3.0 |
valhallaGaming/uno | src_trunk/resources/social-system/c_friends.lua | 1 | 13164 | wFriends, bClose, imgSelf, lName, imgFlag, paneFriends, tMessage, bSendMessage, tFriends = nil
paneFriend = { }
local width, height = 300, 500
local scrWidth, scrHeight = guiGetScreenSize()
x = scrWidth/2 - (width/2)
y = scrHeight/2 - (height/2)
local tableFriends = nil
local fadeTimer = nil
local fadeTimerTB = nil
local localPlayer = getLocalPlayer()
local message = nil
local cachievements = nil
local panels = { }
local names = { }
local onlineimages = { }
local chars = { }
local flags = { }
local messages = { }
local tachievements = { }
local removes = { }
local buttonUpdate = nil
local textMessage = nil
function isPlayerOnline(id)
for key, value in ipairs(getElementsByType("player")) do
local pid = getElementData(value, "gameaccountid")
if (id==pid) then
return true, getPlayerName(value)
end
end
return false
end
function enableMessageEdit(button)
outputDebugString("HIT")
if (button=="left") then
local x, y = guiGetPosition(messages[1], true)
buttonUpdate = guiCreateButton(x+0.15, y, 0.046, 0.03, "Update", true)
guiSetFont(buttonUpdate, "default-bold-small")
guiSetAlpha(buttonUpdate, 0.0)
textMessage = guiCreateEdit(x, y, 0.15, 0.03, tostring(message), true)
guiSetFont(textMessage, "default-bold-small")
guiSetAlpha(textMessage, 0.0)
guiEditSetMaxLength(textMessage, 33)
fadeTimerTB = setTimer(fadeInTextBox, 100, 0)
end
end
function fadeInTextBox()
local alpha = guiGetAlpha(textMessage)
local alpha2 = guiGetAlpha(messages[1])
guiSetAlpha(textMessage, alpha+0.1)
guiSetAlpha(buttonUpdate, alpha+0.1)
guiSetAlpha(messages[1], alpha2-0.1)
if (alpha+0.1>=0.7) then
guiSetVisible(message[1], false)
guiBringToFront(textMessage)
addEventHandler("onClientGUIClick", buttonUpdate, sendMessage, false)
guiSetInputEnabled(true)
killTimer(fadeTimerTB)
end
end
function fadeOutTextBox()
local alpha = guiGetAlpha(textMessage)
local alpha2 = guiGetAlpha(messages[1])
guiSetAlpha(textMessage, alpha-0.1)
guiSetAlpha(buttonUpdate, alpha-0.1)
guiSetAlpha(messages[1], alpha2+0.1)
if (alpha-0.1<=0.0) then
destroyElement(buttonUpdate)
destroyElement(textMessage)
guiSetInputEnabled(false)
guiBringToFront(messages[1])
killTimer(fadeTimerTB)
end
end
function showFriendsUI(friends, fmess, myachievements)
if (fadeTimer) then return end
setElementData(getLocalPlayer(), "friends.visible", 1, true)
local cx = 0.015
local cy = 0.025
local count = 1
tableFriends = friends
message = fmess
cachievements = myachievements
-- SELF
panels[1] = guiCreateTabPanel(cx, cy, 0.24, 0.15, true)
guiSetAlpha(panels[1], 0.0)
local myname = getElementData(localPlayer, "gameaccountusername")
names[1] = guiCreateLabel(cx+0.02, cy+0.02, 0.9, 0.1, tostring(myname), true)
guiSetFont(names[1], "default-bold-small")
guiSetAlpha(names[1], 0.0)
onlineimages[1] = guiCreateStaticImage(cx+0.0075, cy+0.027, 0.0075, 0.0075, "images/grn.png", true)
guiSetAlpha(onlineimages[1], 0.0)
chars[1] = guiCreateLabel(cx+0.02, cy+0.04, 0.9, 0.1, "You are playing as " .. string.gsub(getPlayerName(localPlayer), "_", " "), true)
guiSetFont(chars[1], "default-bold-small")
guiSetAlpha(chars[1], 0.0)
local country = tostring(getElementData(getLocalPlayer(), "country"))
if (country==nil) then country = "zz" end
flags[1] = guiCreateStaticImage(cx+0.213, cy+0.117, 0.02, 0.0175, "images/flags/" .. country .. ".png", true)
guiSetAlpha(flags[1], 0.0)
tachievements[1] = guiCreateLabel(cx+0.02, cy+0.08, 0.9, 0.1, "You have " .. myachievements .. " achievements.", true)
guiSetFont(tachievements[1], "default-bold-small")
guiSetAlpha(tachievements[1], 0.0)
if (string.len(fmess)>33) then
fmess = string.sub(fmess, 1, 33) .. "..."
end
messages[1] = guiCreateLabel(cx+0.02, cy+0.1, 0.15, 0.03, "'" .. tostring(fmess) .. "'", true)
guiSetFont(messages[1], "default-bold-small")
guiSetAlpha(messages[1], 0.0)
addEventHandler("onClientGUIClick", messages[1], enableMessageEdit, false)
showCursor(true)
cy = cy + 0.16
addEventHandler("onClientClick", getRootElement(), resetState)
-- OTHERS
for key, value in ipairs(friends) do
local id, username, message, country, achievements, timeoffline = unpack( value )
panels[key+1] = guiCreateTabPanel(cx, cy, 0.24, 0.15, true) -- 0.25, 0.15
guiSetAlpha(panels[key+1], 0.0)
local found, name = isPlayerOnline(id)
local pid = nil
-- Name
if not found then
names[key+1] = guiCreateLabel(cx+0.02, cy+0.02, 0.9, 0.1, tostring(username), true)
else
pid = getElementData(getPlayerFromNick(name), "playerid")
names[key+1] = guiCreateLabel(cx+0.02, cy+0.02, 0.9, 0.1, tostring(username) .. " (ID: " .. pid .. ")" , true)
end
guiSetFont(names[key+1], "default-bold-small")
guiSetAlpha(names[key+1], 0.0)
-- Online status
local image = "images/red.png"
if (isPlayerOnline(id)) then image = "images/grn.png" end
onlineimages[key+1] = guiCreateStaticImage(cx+0.0075, cy+0.027, 0.0075, 0.0075, image, true)
guiSetAlpha(onlineimages[key+1], 0.0)
-- Current Character
if (found) then
chars[key+1] = guiCreateLabel(cx+0.02, cy+0.04, 0.9, 0.2, "Currently Playing as " .. string.gsub(name, "_", " ") , true)
else
if (timeoffline) then
if (timeoffline==0) then
chars[key+1] = guiCreateLabel(cx+0.02, cy+0.04, 0.9, 0.1, "Last Seen Today.", true)
else
chars[key+1] = guiCreateLabel(cx+0.02, cy+0.04, 0.9, 0.1, "Last Seen " .. timeoffline .. " days ago.", true)
end
else
chars[key+1] = guiCreateLabel(cx+0.02, cy+0.04, 0.9, 0.1, "Last Seen Never.", true)
end
end
guiSetFont(chars[key+1], "default-bold-small")
guiSetAlpha(chars[key+1], 0.0)
-- FLAG
if (country==nil) then country = "zz" end
flags[key+1] = guiCreateStaticImage(cx+0.213, cy+0.117, 0.02, 0.0175, "images/flags/" .. country .. ".png", true)
guiSetAlpha(flags[key+1], 0.0)
-- ACHIEVEMENTS
tachievements[key+1] = guiCreateLabel(cx+0.02, cy+0.08, 0.9, 0.1, achievements .. " Achievements.", true)
guiSetFont(tachievements[key+1], "default-bold-small")
guiSetAlpha(tachievements[key+1], 0.0)
-- MESSAGE
if (string.len(message)>33) then
message = string.sub(message, 1, 33) .. "..."
end
messages[key+1] = guiCreateLabel(cx+0.02, cy+0.1, 0.95, 0.1, "'" .. message .. "'", true)
guiSetFont(messages[key+1], "default-bold-small")
guiSetAlpha(messages[key+1], 0.0)
-- REMOVE
removes[key] = guiCreateLabel(cx+0.226, cy+0.01, 0.01, 0.02, "X", true)
guiSetFont(removes[key], "default-bold-small")
guiSetAlpha(removes[key], 0.0)
addEventHandler("onClientGUIClick", removes[key], removeFriend, false)
cy = cy + 0.16
count = count + 1
if (count >= 6) then
cx = cx + 0.245
cy = 0.025
count = 0
end
end
fadeTimer = setTimer(doFadeInEffect, 50, 0)
end
addEvent("showFriendsList", true)
addEventHandler("showFriendsList", getRootElement(), showFriendsUI)
function resetState()
for key, value in pairs(panels) do
guiMoveToBack(value)
end
end
function sendMessage(button)
if (button=="left") then
message = guiGetText(textMessage)
guiSetVisible(message[1], true)
guiSetText(messages[1], "'" .. tostring(message) .. "'")
if (isTimer(fadeTimerTB)) then killTimer(fadeTimerTB) end
fadeTimerTB = setTimer(fadeOutTextBox, 100, 0)
triggerServerEvent("updateFriendsMessage", getLocalPlayer(), message)
end
end
function doFadeInEffect()
local alpha = nil
for key, value in pairs(panels) do
alpha = guiGetAlpha(value)
guiSetAlpha(value, alpha+0.1)
end
if (alpha+0.1 >= 0.7) and isTimer(fadeTimer) then
killTimer(fadeTimer)
fadeTimer = setTimer(doFadeInContent, 50, 0)
end
end
function doFadeInContent()
local alpha = nil
for key, value in pairs(names) do
alpha = guiGetAlpha(value)
guiSetAlpha(value, alpha+0.1)
guiSetAlpha(onlineimages[key], alpha+0.1)
guiSetAlpha(chars[key], alpha+0.1)
guiSetAlpha(flags[key], alpha+0.1)
guiSetAlpha(tachievements[key], alpha+0.1)
guiSetAlpha(messages[key], alpha+0.1)
guiSetAlpha(removes[key], alpha+0.1)
end
if (alpha+0.1 >= 0.7) and isTimer(fadeTimer) then
killTimer(fadeTimer)
fadeTimer = nil
end
end
function doFadeOutEffect(fadeBackIn)
local alpha = nil
for key, value in pairs(panels) do
alpha = guiGetAlpha(value)
guiSetAlpha(value, alpha-0.1)
if (alpha-0.1 <= 0.0) then
destroyElement(value)
end
end
if (alpha-0.1 <= 0.0) and isTimer(fadeTimer) then
killTimer(fadeTimer)
removeEventHandler("onClientClick", getRootElement(), resetState)
panels = { }
names = { }
onlineimages = { }
chars = { }
flags = { }
tachievements = { }
messages = { }
removes = { }
if (fadeBackIn) then
fadeTimer = nil
showFriendsUI(tableFriends, message, cachievements)
else
tableFriends = nil
fadeTimer = nil
tableFriends = nil
buttonUpdate = nil
textMessage = nil
cachievements = nil
end
end
end
function doFadeOutContent(fadeBackIn)
local alpha = nil
if (isTimer(fadeTimerTB)) then killTimer(fadeTimerTB) end
for key, value in pairs(names) do
alpha = guiGetAlpha(value)
guiSetAlpha(value, alpha-0.1)
guiSetAlpha(onlineimages[key], alpha-0.1)
guiSetAlpha(chars[key], alpha-0.1)
guiSetAlpha(flags[key], alpha-0.1)
guiSetAlpha(tachievements[key], alpha-0.1)
guiSetAlpha(messages[key], alpha-0.1)
guiSetAlpha(removes[key], alpha-0.1)
if (isElement(textMessage) and (guiGetAlpha(textMessage)>0.0)) then guiSetAlpha(textMessage, alpha-0.1) end
if (isElement(buttonUpdate) and (guiGetAlpha(textMessage)>0.0)) then guiSetAlpha(buttonUpdate, alpha-0.1) end
if (alpha-0.1 <= 0.0) then
destroyElement(value)
if (isElement(onlineimages[key])) then
destroyElement(onlineimages[key])
end
if (isElement(chars[key])) then
destroyElement(chars[key])
end
if (isElement(flags[key])) then
destroyElement(flags[key])
end
if (isElement(tachievements[key])) then
destroyElement(tachievements[key])
end
if (isElement(messages[key])) then
destroyElement(messages[key])
end
if (isElement(removes[key])) then
destroyElement(removes[key])
end
if (isElement(buttonUpdate)) then
destroyElement(buttonUpdate)
end
if (isElement(textMessage)) then
destroyElement(textMessage)
end
end
end
if (alpha-0.1 <= 0.0) and isTimer(fadeTimer) then
killTimer(fadeTimer)
fadeTimer = setTimer(doFadeOutEffect, 50, 0, fadeBackIn)
end
end
function hideFriendsUI(informServer, fadeBackIn)
if (fadeTimer) then return end
fadeTimer = setTimer(doFadeOutContent, 50, 0, fadeBackIn)
guiSetInputEnabled(false)
showCursor(false)
if (informServer or informServer==nil) then
setElementData(getLocalPlayer(), "friends.visible", 0, true)
end
end
addEvent("hideFriendsList", true)
addEventHandler("hideFriendsList", getRootElement(), hideFriendsUI)
local clicked = false
function removeFriend(button)
if (button=="left") and (clicked == false) then
local targetvalue = nil
for key, value in pairs(removes) do
if (tostring(value)==tostring(source)) then
targetvalue = key
end
end
if (targetvalue) then
clicked = true
local id, username, message, country, achievements, timeoffline = unpack(tableFriends[targetvalue])
fadeTimerTB = setTimer(fadeOutFriend, 100, 0, targetvalue+1)
triggerServerEvent("removeFriend", getLocalPlayer(), id, username, false)
end
end
end
function fadeOutFriend(key)
local alpha = guiGetAlpha(messages[key])
guiSetAlpha(panels[key], alpha-0.1)
guiSetAlpha(onlineimages[key], alpha-0.1)
guiSetAlpha(chars[key], alpha-0.1)
guiSetAlpha(flags[key], alpha-0.1)
guiSetAlpha(names[key], alpha-0.1)
guiSetAlpha(tachievements[key], alpha-0.1)
guiSetAlpha(messages[key], alpha-0.1)
guiSetAlpha(removes[key-1], alpha-0.1)
if (alpha-0.1<=0.0) then
clicked = false
killTimer(fadeTimerTB)
table.remove(panels, key)
table.remove(onlineimages, key)
table.remove(chars, key)
table.remove(flags, key)
table.remove(names, key)
table.remove(tachievements, key)
table.remove(messages, key)
table.remove(removes, key-1)
table.remove(tableFriends, key-1)
hideFriendsUI(false, true)
end
end
function toggleCursor()
if (isCursorShowing()) then
showCursor(false)
else
showCursor(true)
end
end
addCommandHandler("togglecursor", toggleCursor)
bindKey("m", "down", "togglecursor")
function cursorHide()
showCursor(false)
end
addEvent("cursorHide", false)
addEventHandler("cursorHide", getRootElement(), cursorHide)
function cursorShow()
showCursor(true)
end
addEvent("cursorShow", false)
addEventHandler("cursorShow", getRootElement(), cursorShow)
| bsd-3-clause |
ajayk/kong | kong/cli/utils/ssl.lua | 3 | 2662 | local logger = require "kong.cli.utils.logger"
local utils = require "kong.tools.utils"
local IO = require "kong.tools.io"
local _M = {}
function _M.get_ssl_cert_and_key(kong_config)
local ssl_cert_path, ssl_key_path
if (kong_config.ssl_cert_path and not kong_config.ssl_key_path) or
(kong_config.ssl_key_path and not kong_config.ssl_cert_path) then
return false, "Both \"ssl_cert_path\" and \"ssl_key_path\" need to be specified in the configuration, or none of them"
elseif kong_config.ssl_cert_path and kong_config.ssl_key_path then
ssl_cert_path = kong_config.ssl_cert_path
ssl_key_path = kong_config.ssl_key_path
else
ssl_cert_path = IO.path:join(kong_config.nginx_working_dir, "ssl", "kong-default.crt")
ssl_key_path = IO.path:join(kong_config.nginx_working_dir, "ssl", "kong-default.key")
end
-- Check that the file exists
if ssl_cert_path and not IO.file_exists(ssl_cert_path) then
return false, "Can't find default Kong SSL certificate at: "..ssl_cert_path
end
if ssl_key_path and not IO.file_exists(ssl_key_path) then
return false, "Can't find default Kong SSL key at: "..ssl_key_path
end
return { ssl_cert_path = ssl_cert_path, ssl_key_path = ssl_key_path }
end
function _M.prepare_ssl(kong_config)
local ssl_cert_path = IO.path:join(kong_config.nginx_working_dir, "ssl", "kong-default.crt")
local ssl_key_path = IO.path:join(kong_config.nginx_working_dir, "ssl", "kong-default.key")
if not (IO.file_exists(ssl_cert_path) and IO.file_exists(ssl_key_path)) then
-- Autogenerating the certificates for the first time
logger:info("Auto-generating the default SSL certificate and key...")
local file_name = os.tmpname()
local passphrase = utils.random_string()
local res, code = IO.os_execute([[
cd /tmp && \
openssl genrsa -des3 -out ]]..file_name..[[.key -passout pass:]]..passphrase..[[ 1024 && \
openssl req -new -key ]]..file_name..[[.key -out ]]..file_name..[[.csr -subj "/C=US/ST=California/L=San Francisco/O=Kong/OU=IT Department/CN=localhost" -passin pass:]]..passphrase..[[ && \
cp ]]..file_name..[[.key ]]..file_name..[[.key.org && \
openssl rsa -in ]]..file_name..[[.key.org -out ]]..file_name..[[.key -passin pass:]]..passphrase..[[ && \
openssl x509 -req -in ]]..file_name..[[.csr -signkey ]]..file_name..[[.key -out ]]..file_name..[[.crt && \
mv ]]..file_name..[[.crt ]]..ssl_cert_path..[[ && \
mv ]]..file_name..[[.key ]]..ssl_key_path)
if code ~= 0 then
return false, "There was an error when auto-generating the default SSL certificate: "..res
end
return true
end
end
return _M | apache-2.0 |
mercury233/ygopro-scripts | c42461852.lua | 2 | 2147 | --サイバネット・ストーム
function c42461852.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--atk/def up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_FZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(aux.TargetBoolFunction(Card.IsLinkState))
e2:SetValue(500)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e3)
--cannot disable summon
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_DISABLE_SPSUMMON)
e4:SetRange(LOCATION_FZONE)
e4:SetProperty(EFFECT_FLAG_IGNORE_RANGE+EFFECT_FLAG_SET_AVAILABLE)
e4:SetTarget(aux.TargetBoolFunction(Card.IsSummonType,SUMMON_TYPE_LINK))
c:RegisterEffect(e4)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(42461852,0))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DAMAGE)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_CAL)
e5:SetRange(LOCATION_FZONE)
e5:SetCondition(c42461852.spcon)
e5:SetTarget(c42461852.sptg)
e5:SetOperation(c42461852.spop)
c:RegisterEffect(e5)
end
function c42461852.spcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp and ev>=2000
end
function c42461852.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFacedown,tp,LOCATION_EXTRA,0,1,nil)
and Duel.IsPlayerCanSpecialSummon(tp)
and Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_LINK)>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c42461852.spop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsPlayerCanSpecialSummon(tp)
or Duel.GetMatchingGroupCount(Card.IsFacedown,tp,LOCATION_EXTRA,0,nil)==0 then return end
Duel.ShuffleExtra(tp)
Duel.ConfirmExtratop(tp,1)
local tc=Duel.GetExtraTopGroup(tp,1):GetFirst()
if tc:IsType(TYPE_LINK) and tc:IsRace(RACE_CYBERSE) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c88413677.lua | 2 | 2573 | --ドヨン@イグニスター
function c88413677.initial_effect(c)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(88413677,0))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1,88413677)
e1:SetTarget(c88413677.thtg1)
e1:SetOperation(c88413677.thop1)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--to hand
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(88413677,1))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_BE_MATERIAL)
e3:SetCountLimit(1,88413678)
e3:SetCondition(c88413677.thcon2)
e3:SetTarget(c88413677.thtg2)
e3:SetOperation(c88413677.thop2)
c:RegisterEffect(e3)
end
function c88413677.thfilter1(c)
return c:IsSetCard(0x135) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c88413677.thtg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c88413677.thfilter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(c88413677.thfilter1,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c88413677.thfilter1,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c88413677.thop1(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
function c88413677.thcon2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return r==REASON_LINK and c:GetReasonCard():IsRace(RACE_CYBERSE) and c:IsLocation(LOCATION_GRAVE)
end
function c88413677.thfilter2(c)
return c:IsSetCard(0x136) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function c88413677.thtg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c88413677.thfilter2(chkc) end
if chk==0 then return Duel.IsExistingTarget(c88413677.thfilter2,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c88413677.thfilter2,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c88413677.thop2(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 |
AntonioModer/fuccboiGDX | fuccboi/libraries/loveframes/libraries/util.lua | 6 | 10255 | --[[------------------------------------------------
-- Love Frames - A GUI library for LOVE --
-- Copyright (c) 2012-2014 Kenny Shields --
--]]------------------------------------------------
-- util library
loveframes.util = {}
--[[---------------------------------------------------------
- func: SetActiveSkin(name)
- desc: sets the active skin
--]]---------------------------------------------------------
function loveframes.util.SetActiveSkin(name)
loveframes.config["ACTIVESKIN"] = name
end
--[[---------------------------------------------------------
- func: GetActiveSkin()
- desc: gets the active skin
--]]---------------------------------------------------------
function loveframes.util.GetActiveSkin()
local index = loveframes.config["ACTIVESKIN"]
local skin = loveframes.skins.available[index]
return skin
end
--[[---------------------------------------------------------
- func: BoundingBox(x1, x2, y1, y2, w1, w2, h1, h2)
- desc: checks for a collision between two boxes
- note: I take no credit for this function
--]]---------------------------------------------------------
function loveframes.util.BoundingBox(x1, x2, y1, y2, w1, w2, h1, h2)
if x1 > x2 + w2 - 1 or y1 > y2 + h2 - 1 or x2 > x1 + w1 - 1 or y2 > y1 + h1 - 1 then
return false
else
return true
end
end
--[[---------------------------------------------------------
- func: loveframes.util.GetCollisions(object, table)
- desc: gets all objects colliding with the mouse
--]]---------------------------------------------------------
function loveframes.util.GetCollisions(object, t)
local x, y = love.mouse.getPosition()
local curstate = loveframes.state
local object = object or loveframes.base
local visible = object.visible
local children = object.children
local internals = object.internals
local objectstate = object.state
local t = t or {}
if objectstate == curstate and visible then
local objectx = object.x
local objecty = object.y
local objectwidth = object.width
local objectheight = object.height
local col = loveframes.util.BoundingBox(x, objectx, y, objecty, 1, objectwidth, 1, objectheight)
local collide = object.collide
if col and collide then
local clickbounds = object.clickbounds
if clickbounds then
local cx = clickbounds.x
local cy = clickbounds.y
local cwidth = clickbounds.width
local cheight = clickbounds.height
local clickcol = loveframes.util.BoundingBox(x, cx, y, cy, 1, cwidth, 1, cheight)
if clickcol then
table.insert(t, object)
end
else
table.insert(t, object)
end
end
if children then
for k, v in ipairs(children) do
loveframes.util.GetCollisions(v, t)
end
end
if internals then
for k, v in ipairs(internals) do
local type = v.type
if type ~= "tooltip" then
loveframes.util.GetCollisions(v, t)
end
end
end
end
return t
end
--[[---------------------------------------------------------
- func: loveframes.util.GetAllObjects(object, table)
- desc: gets all active objects
--]]---------------------------------------------------------
function loveframes.util.GetAllObjects(object, t)
local object = object or loveframes.base
local internals = object.internals
local children = object.children
local t = t or {}
table.insert(t, object)
if internals then
for k, v in ipairs(internals) do
loveframes.util.GetAllObjects(v, t)
end
end
if children then
for k, v in ipairs(children) do
loveframes.util.GetAllObjects(v, t)
end
end
return t
end
--[[---------------------------------------------------------
- func: GetDirectoryContents(directory, table)
- desc: gets the contents of a directory and all of
its subdirectories
--]]---------------------------------------------------------
function loveframes.util.GetDirectoryContents(dir, t)
local dir = dir
local t = t or {}
local dirs = {}
local files = love.filesystem.getDirectoryItems(dir)
for k, v in ipairs(files) do
local isdir = love.filesystem.isDirectory(dir.. "/" ..v)
if isdir == true then
table.insert(dirs, dir.. "/" ..v)
else
local parts = loveframes.util.SplitString(v, "([.])")
local extension = parts[#parts]
parts[#parts] = nil
local name = table.concat(parts)
table.insert(t, {
path = dir,
fullpath = dir.. "/" ..v,
requirepath = dir:gsub("/", ".") .. "." ..name,
name = name,
extension = extension
})
end
end
if #dirs > 0 then
for k, v in ipairs(dirs) do
t = loveframes.util.GetDirectoryContents(v, t)
end
end
return t
end
--[[---------------------------------------------------------
- func: Round(num, idp)
- desc: rounds a number based on the decimal limit
- note: I take no credit for this function
--]]---------------------------------------------------------
function loveframes.util.Round(num, idp)
local mult = 10^(idp or 0)
if num >= 0 then
return math.floor(num * mult + 0.5) / mult
else
return math.ceil(num * mult - 0.5) / mult
end
end
--[[---------------------------------------------------------
- func: SplitString(string, pattern)
- desc: splits a string into a table based on a given pattern
- note: I take no credit for this function
--]]---------------------------------------------------------
function loveframes.util.SplitString(str, pat)
local t = {} -- NOTE: use {n = 0} in Lua-5.0
if pat == " " then
local fpat = "(.-)" .. pat
local last_end = 1
local s, e, cap = str:find(fpat, 1)
while s do
if s ~= #str then
cap = cap .. " "
end
if s ~= 1 or cap ~= "" then
table.insert(t,cap)
end
last_end = e+1
s, e, cap = str:find(fpat, last_end)
end
if last_end <= #str then
cap = str:sub(last_end)
table.insert(t, cap)
end
else
local fpat = "(.-)" .. pat
local last_end = 1
local s, e, cap = str:find(fpat, 1)
while s do
if s ~= 1 or cap ~= "" then
table.insert(t,cap)
end
last_end = e+1
s, e, cap = str:find(fpat, last_end)
end
if last_end <= #str then
cap = str:sub(last_end)
table.insert(t, cap)
end
end
return t
end
--[[---------------------------------------------------------
- func: RemoveAll()
- desc: removes all gui elements
--]]---------------------------------------------------------
function loveframes.util.RemoveAll()
loveframes.base.children = {}
loveframes.base.internals = {}
loveframes.hoverobject = false
loveframes.downobject = false
loveframes.modalobject = false
loveframes.inputobject = false
loveframes.hover = false
end
--[[---------------------------------------------------------
- func: loveframes.util.TableHasValue(table, value)
- desc: checks to see if a table has a specific value
--]]---------------------------------------------------------
function loveframes.util.TableHasValue(table, value)
for k, v in pairs(table) do
if v == value then
return true
end
end
return false
end
--[[---------------------------------------------------------
- func: loveframes.util.TableHasKey(table, key)
- desc: checks to see if a table has a specific key
--]]---------------------------------------------------------
function loveframes.util.TableHasKey(table, key)
return table[key] ~= nil
end
--[[---------------------------------------------------------
- func: loveframes.util.Error(message)
- desc: displays a formatted error message
--]]---------------------------------------------------------
function loveframes.util.Error(message)
error("[Love Frames] " ..message)
end
--[[---------------------------------------------------------
- func: loveframes.util.GetCollisionCount()
- desc: gets the total number of objects colliding with
the mouse
--]]---------------------------------------------------------
function loveframes.util.GetCollisionCount()
return loveframes.collisioncount
end
--[[---------------------------------------------------------
- func: loveframes.util.GetHover()
- desc: returns loveframes.hover, can be used to check
if the mouse is colliding with a visible
Love Frames object
--]]---------------------------------------------------------
function loveframes.util.GetHover()
return loveframes.hover
end
--[[---------------------------------------------------------
- func: RectangleCollisionCheck(rect1, rect2)
- desc: checks for a collision between two rectangles
based on two tables containing rectangle sizes
and positions
--]]---------------------------------------------------------
function loveframes.util.RectangleCollisionCheck(rect1, rect2)
return loveframes.util.BoundingBox(rect1.x, rect2.x, rect1.y, rect2.y, rect1.width, rect2.width, rect1.height, rect2.height)
end
--[[---------------------------------------------------------
- func: loveframes.util.DeepCopy(orig)
- desc: copies a table
- note: I take not credit for this function
--]]---------------------------------------------------------
function loveframes.util.DeepCopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[loveframes.util.DeepCopy(orig_key)] = loveframes.util.DeepCopy(orig_value)
end
setmetatable(copy, loveframes.util.DeepCopy(getmetatable(orig)))
else -- number, string, boolean, etc
copy = orig
end
return copy
end
--[[---------------------------------------------------------
- func: loveframes.util.GetHoverObject()
- desc: returns loveframes.hoverobject
--]]---------------------------------------------------------
function loveframes.util.GetHoverObject()
return loveframes.hoverobject
end
--[[---------------------------------------------------------
- func: loveframes.util.IsCtrlDown()
- desc: checks for ctrl, for use with multiselect, copy,
paste, and such. On OS X it actually looks for cmd.
--]]---------------------------------------------------------
function loveframes.util.IsCtrlDown()
if love._os == "OS X" then
return love.keyboard.isDown("lmeta") or love.keyboard.isDown("rmeta") or
love.keyboard.isDown("lgui") or love.keyboard.isDown("rgui")
end
return love.keyboard.isDown("lctrl") or love.keyboard.isDown("rctrl")
end | mit |
Zenny89/darkstar | scripts/zones/The_Eldieme_Necropolis/npcs/_5f3.lua | 34 | 1109 | -----------------------------------
-- Area: The Eldieme Necropolis
-- NPC: Leviathan's Gate
-- @pos 145 -34 20 195
-----------------------------------
package.loaded["scripts/zones/The_Eldieme_Necropolis/TextIDs"] = nil;
-----------------------------------
require("scripts/zones/The_Eldieme_Necropolis/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (npc:getAnimation() == 9) then
player:messageSpecial(SOLID_STONE);
end
return 0;
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 |
mercury233/ygopro-scripts | c5821478.lua | 2 | 2776 | --トポロジック・ボマー・ドラゴン
function c5821478.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkType,TYPE_EFFECT),2)
c:EnableReviveLimit()
--damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(5821478,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c5821478.descon)
e1:SetTarget(c5821478.destg)
e1:SetOperation(c5821478.desop)
c:RegisterEffect(e1)
--damage
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(5821478,1))
e2:SetCategory(CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_BATTLED)
e2:SetCondition(c5821478.damcon)
e2:SetTarget(c5821478.damtg)
e2:SetOperation(c5821478.damop)
c:RegisterEffect(e2)
end
function c5821478.cfilter(c,zone)
local seq=c:GetSequence()
if c:IsLocation(LOCATION_MZONE) then
if c:IsControler(1) then seq=seq+16 end
else
seq=c:GetPreviousSequence()
if c:IsPreviousControler(1) then seq=seq+16 end
end
return bit.extract(zone,seq)~=0
end
function c5821478.descon(e,tp,eg,ep,ev,re,r,rp)
local zone=Duel.GetLinkedZone(0)+(Duel.GetLinkedZone(1)<<0x10)
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c5821478.cfilter,1,nil,zone)
end
function c5821478.desfilter(c)
return c:GetSequence()<5
end
function c5821478.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(5821478)==0 end
e:GetHandler():RegisterFlagEffect(5821478,RESET_CHAIN,0,1)
local g=Duel.GetMatchingGroup(c5821478.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c5821478.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c5821478.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.Destroy(g,REASON_EFFECT)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(c5821478.ftarget)
e1:SetLabel(e:GetHandler():GetFieldID())
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c5821478.ftarget(e,c)
return e:GetLabel()~=c:GetFieldID()
end
function c5821478.damcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker()==e:GetHandler() and Duel.GetAttackTarget()
end
function c5821478.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,Duel.GetAttackTarget():GetBaseAttack())
end
function c5821478.damop(e,tp,eg,ep,ev,re,r,rp)
local bc=Duel.GetAttackTarget()
if bc and bc:IsRelateToBattle() and bc:IsFaceup() then
Duel.Damage(1-tp,bc:GetBaseAttack(),REASON_EFFECT)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c13247801.lua | 2 | 2707 | --機甲部隊の防衛圏
function c13247801.initial_effect(c)
--activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0)
--atk limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e1:SetRange(LOCATION_SZONE)
e1:SetTargetRange(0,LOCATION_MZONE)
e1:SetCondition(c13247801.tgcon)
e1:SetValue(c13247801.tgtg)
c:RegisterEffect(e1)
--cannot be target
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetCondition(c13247801.tgcon)
e2:SetTarget(c13247801.tgtg)
e2:SetValue(aux.tgoval)
c:RegisterEffect(e2)
--to hand
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(13247801,0))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1,13247801)
e3:SetCondition(c13247801.thcon)
e3:SetTarget(c13247801.thtg)
e3:SetOperation(c13247801.thop)
c:RegisterEffect(e3)
end
function c13247801.tgfilter(c)
return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsLevelAbove(7)
end
function c13247801.tgcon(e)
return Duel.IsExistingMatchingCard(c13247801.tgfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function c13247801.tgtg(e,c)
return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsLevelBelow(6)
end
function c13247801.sfilter(c,tp)
return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp)
and bit.band(c:GetPreviousRaceOnField(),RACE_MACHINE)~=0
and c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE)
end
function c13247801.thcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c13247801.sfilter,1,nil,tp) and not eg:IsContains(e:GetHandler())
end
function c13247801.thfilter(c)
return c:IsRace(RACE_MACHINE) and c:IsAbleToHand()
end
function c13247801.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c13247801.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c13247801.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c13247801.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c13247801.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 |
AntonioModer/fuccboiGDX | fuccboi/libraries/hump/vector.lua | 1 | 5544 | --[[
Copyright (c) 2010-2013 Matthias Richter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Except as contained in this notice, the name(s) of the above copyright holders
shall not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization.
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.
]]--
local assert = assert
local sqrt, cos, sin, atan, atan2 = math.sqrt, math.cos, math.sin, math.atan, math.atan2
local vector = {}
vector.__index = vector
local function new(x,y)
return setmetatable({x = x or 0, y = y or 0}, vector)
end
local zero = new(0,0)
local function isvector(v)
return getmetatable(v) == vector
end
function vector:clone()
return new(self.x, self.y)
end
function vector:unpack()
return self.x, self.y
end
function vector:__tostring()
return "("..tonumber(self.x)..","..tonumber(self.y)..")"
end
function vector.__unm(a)
return new(-a.x, -a.y)
end
function vector.__add(a,b)
assert(isvector(a) and isvector(b), "Add: wrong argument types (<vector> expected)")
return new(a.x+b.x, a.y+b.y)
end
function vector.__sub(a,b)
assert(isvector(a) and isvector(b), "Sub: wrong argument types (<vector> expected)")
return new(a.x-b.x, a.y-b.y)
end
function vector.__mul(a,b)
if type(a) == "number" then
return new(a*b.x, a*b.y)
elseif type(b) == "number" then
return new(b*a.x, b*a.y)
else
assert(isvector(a) and isvector(b), "Mul: wrong argument types (<vector> or <number> expected)")
return a.x*b.x + a.y*b.y
end
end
function vector.__div(a,b)
assert(isvector(a) and type(b) == "number", "wrong argument types (expected <vector> / <number>)")
return new(a.x / b, a.y / b)
end
function vector.__eq(a,b)
return a.x == b.x and a.y == b.y
end
function vector.__lt(a,b)
return a.x < b.x or (a.x == b.x and a.y < b.y)
end
function vector.__le(a,b)
return a.x <= b.x and a.y <= b.y
end
function vector.permul(a,b)
assert(isvector(a) and isvector(b), "permul: wrong argument types (<vector> expected)")
return new(a.x*b.x, a.y*b.y)
end
function vector.dot(a, b)
return a.x*b.x + a.y*b.y
end
function vector:len2()
return self.x * self.x + self.y * self.y
end
function vector:len()
return sqrt(self.x * self.x + self.y * self.y)
end
function vector.dist(a, b)
assert(isvector(a) and isvector(b), "dist: wrong argument types (<vector> expected)")
local dx = a.x - b.x
local dy = a.y - b.y
return sqrt(dx * dx + dy * dy)
end
function vector.dist2(a, b)
assert(isvector(a) and isvector(b), "dist: wrong argument types (<vector> expected)")
local dx = a.x - b.x
local dy = a.y - b.y
return (dx * dx + dy * dy)
end
function vector:normalizeInplace()
local l = self:len()
if l > 0 then
self.x, self.y = self.x / l, self.y / l
end
return self
end
function vector:normalized()
return self:clone():normalizeInplace()
end
function vector:rotateInplace(phi)
local c, s = cos(phi), sin(phi)
self.x, self.y = c * self.x - s * self.y, s * self.x + c * self.y
return self
end
function vector:rotated(phi)
local c, s = cos(phi), sin(phi)
return new(c * self.x - s * self.y, s * self.x + c * self.y)
end
function vector:perpendicular()
return new(-self.y, self.x)
end
function vector:projectOn(v)
assert(isvector(v), "invalid argument: cannot project vector on " .. type(v))
-- (self * v) * v / v:len2()
local s = (self.x * v.x + self.y * v.y) / (v.x * v.x + v.y * v.y)
return new(s * v.x, s * v.y)
end
function vector:mirrorOn(v)
assert(isvector(v), "invalid argument: cannot mirror vector on " .. type(v))
-- 2 * self:projectOn(v) - self
local s = 2 * (self.x * v.x + self.y * v.y) / (v.x * v.x + v.y * v.y)
return new(s * v.x - self.x, s * v.y - self.y)
end
function vector:cross(v)
assert(isvector(v), "cross: wrong argument types (<vector> expected)")
return self.x * v.y - self.y * v.x
end
-- ref.: http://blog.signalsondisplay.com/?p=336
function vector:trimInplace(maxLen)
local s = maxLen * maxLen / self:len2()
s = s < 1 and 1 or math.sqrt(s)
self.x, self.y = self.x * s, self.y * s
return self
end
function vector:truncate(max)
if self:len() > max then
self:normalizeInplace()
self.x, self.y = self.x*max, self.y*max
end
return self
end
function vector:angle()
return atan2(self.y, self.x)
end
function vector:angleTo(other)
other = other or zero
return atan2(self.y - other.y, self.x - other.x)
end
function vector:trimmed(maxLen)
return self:clone():trimInplace(maxLen)
end
-- the module
return setmetatable({new = new, isvector = isvector, zero = zero},
{__call = function(_, ...) return new(...) end})
| mit |
mercury233/ygopro-scripts | c82670878.lua | 2 | 3853 | --血涙のオーガ
function c82670878.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(82670878,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_CUSTOM+82670878)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c82670878.condition)
e1:SetTarget(c82670878.target)
e1:SetOperation(c82670878.operation)
c:RegisterEffect(e1)
--atk/def up
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(82670878,1))
e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(c82670878.adcon)
e2:SetOperation(c82670878.adop)
c:RegisterEffect(e2)
if not c82670878.global_check then
c82670878.global_check=true
c82670878[0]=0
c82670878[1]=0
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_ATTACK_ANNOUNCE)
ge1:SetOperation(c82670878.check)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_ATTACK_DISABLED)
ge2:SetOperation(c82670878.check2)
Duel.RegisterEffect(ge2,0)
local ge3=Effect.CreateEffect(c)
ge3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge3:SetCode(EVENT_PHASE_START+PHASE_DRAW)
ge3:SetOperation(c82670878.clear)
Duel.RegisterEffect(ge3,0)
end
end
function c82670878.check(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if Duel.GetAttackTarget()==nil then
c82670878[1-tc:GetControler()]=c82670878[1-tc:GetControler()]+1
if c82670878[1-tc:GetControler()]==1 then
c82670878[2]=tc
tc:RegisterFlagEffect(82670878,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
elseif c82670878[1-tc:GetControler()]==2 then
Duel.RaiseEvent(tc,EVENT_CUSTOM+82670878,e,0,0,0,0)
end
end
end
function c82670878.check2(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if tc:GetFlagEffect(82670878)~=0 and Duel.GetAttackTarget()~=nil then
c82670878[1-tc:GetControler()]=c82670878[1-tc:GetControler()]-1
end
end
function c82670878.clear(e,tp,eg,ep,ev,re,r,rp)
c82670878[0]=0
c82670878[1]=0
end
function c82670878.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp and Duel.GetAttackTarget()==nil and c82670878[tp]==2
end
function c82670878.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function c82670878.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,SUMMON_VALUE_SELF,tp,tp,false,false,POS_FACEUP)
end
function c82670878.adcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+SUMMON_VALUE_SELF
end
function c82670878.adop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=c82670878[2]
if c:IsFaceup() and c:IsRelateToEffect(e) then
if tc and tc:GetFlagEffect(82670878) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
e1:SetValue(tc:GetAttack())
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
e2:SetValue(tc:GetDefense())
c:RegisterEffect(e2)
end
--at limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(0,LOCATION_MZONE)
e3:SetValue(c82670878.atlimit)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e3)
end
end
function c82670878.atlimit(e,c)
return c~=e:GetHandler()
end
| gpl-2.0 |
mercury233/ygopro-scripts | c81661951.lua | 6 | 1240 | --ドラグニティ-ミリトゥム
function c81661951.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(81661951,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c81661951.sptg)
e1:SetOperation(c81661951.spop)
c:RegisterEffect(e1)
end
function c81661951.filter(c,e,tp)
return c:IsFaceup() and c:IsSetCard(0x29) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c81661951.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_SZONE) and c81661951.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c81661951.filter,tp,LOCATION_SZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c81661951.filter,tp,LOCATION_SZONE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c81661951.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 |
mercury233/ygopro-scripts | c21663205.lua | 2 | 1642 | --墓守の神職
function c21663205.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(21663205,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,21663205)
e1:SetTarget(c21663205.sptg)
e1:SetOperation(c21663205.spop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
--immune to necro valley
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_NECRO_VALLEY_IM)
c:RegisterEffect(e4)
end
function c21663205.filter(c,e,tp)
return c:IsLevel(4) and c:IsSetCard(0x2e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)
end
function c21663205.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c21663205.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c21663205.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c21663205.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c21663205.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_ATTACK+POS_FACEDOWN_DEFENSE)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/globals/items/bowl_of_loach_soup.lua | 36 | 1539 | -----------------------------------------
-- ID: 5671
-- Item: Bowl of Loach Soup
-- Food Effect: 4 Hrs, All Races
-----------------------------------------
-- Dexterity 4
-- Agility 4
-- Accuracy 7% Cap 50
-- HP 7% Cap 50
-- Evasion 5
-----------------------------------------
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,14400,5671);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_DEX, 4);
target:addMod(MOD_AGI, 4);
target:addMod(MOD_FOOD_ACCP, 7);
target:addMod(MOD_FOOD_ACC_CAP, 50);
target:addMod(MOD_FOOD_HPP, 7);
target:addMod(MOD_FOOD_HP_CAP, 50);
target:addMod(MOD_EVA, 5);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_DEX, 4);
target:delMod(MOD_AGI, 4);
target:delMod(MOD_FOOD_ACCP, 7);
target:delMod(MOD_FOOD_ACC_CAP, 50);
target:delMod(MOD_FOOD_HPP, 7);
target:delMod(MOD_FOOD_HP_CAP, 50);
target:delMod(MOD_EVA, 5);
end;
| gpl-3.0 |
Zenny89/darkstar | scripts/globals/magic.lua | 2 | 58002 | require("scripts/globals/magicburst")
require("scripts/globals/status")
require("scripts/globals/weather")
require("scripts/globals/utils")
MMSG_BUFF_FAIL = 75;
DIVINE_MAGIC_SKILL = 32;
HEALING_MAGIC_SKILL = 33;
ENHANCING_MAGIC_SKILL = 34;
ENFEEBLING_MAGIC_SKILL = 35;
ELEMENTAL_MAGIC_SKILL = 36;
DARK_MAGIC_SKILL = 37;
NINJUTSU_SKILL = 39;
SUMMONING_SKILL = 38;
SINGING_SKILL = 40;
STRING_SKILL = 41;
WIND_SKILL = 42;
BLUE_SKILL = 43;
FIRESDAY = 0;
EARTHSDAY = 1;
WATERSDAY = 2;
WINDSDAY = 3;
ICEDAY = 4;
LIGHTNINGDAY = 5;
LIGHTSDAY = 6;
DARKSDAY = 7;
ELE_NONE = 0;
ELE_FIRE = 1;
ELE_EARTH = 2;
ELE_WATER = 3;
ELE_WIND = 4;
ELE_ICE = 5;
ELE_LIGHTNING = 6;
-- added both because monsterstpmoves calls it thunder
ELE_THUNDER = 6;
ELE_LIGHT = 7;
ELE_DARK = 8;
dayStrong = {FIRESDAY, EARTHSDAY, WATERSDAY, WINDSDAY, ICEDAY, LIGHTNINGDAY, LIGHTSDAY, DARKSDAY};
dayWeak = {WATERSDAY, WINDSDAY, LIGHTNINGDAY, ICEDAY, FIRESDAY, EARTHSDAY, DARKSDAY, LIGHTSDAY};
singleWeatherStrong = {WEATHER_HOT_SPELL, WEATHER_DUST_STORM, WEATHER_RAIN, WEATHER_WIND, WEATHER_SNOW, WEATHER_THUNDER, WEATHER_AURORAS, WEATHER_GLOOM};
doubleWeatherStrong = {WEATHER_HEAT_WAVE, WEATHER_SAND_STORM, WEATHER_SQUALL, WEATHER_GALES, WEATHER_BLIZZARDS, WEATHER_THUNDERSTORMS, WEATHER_STELLAR_GLARE, WEATHER_DARKNESS};
singleWeatherWeak = {WEATHER_RAIN, WEATHER_WIND, WEATHER_THUNDER, WEATHER_SNOW, WEATHER_HOT_SPELL, WEATHER_DUST_STORM, WEATHER_GLOOM, WEATHER_AURORAS};
doubleWeatherWeak = {WEATHER_SQUALL, WEATHER_GALES, WEATHER_THUNDERSTORMS, WEATHER_BLIZZARDS, WEATHER_HEAT_WAVE, WEATHER_SAND_STORM, WEATHER_DARKNESS, WEATHER_STELLAR_GLARE};
elementalObi = {15435, 15438, 15440, 15437, 15436, 15439, 15441, 15442};
elementalObiWeak = {15440, 15437, 15439, 15436, 15435, 15438, 15442, 15441};
spellAcc = {MOD_FIREACC, MOD_EARTHACC, MOD_WATERACC, MOD_WINDACC, MOD_ICEACC, MOD_THUNDERACC, MOD_LIGHTACC, MOD_DARKACC};
strongAffinity = {MOD_FIRE_AFFINITY, MOD_EARTH_AFFINITY, MOD_WATER_AFFINITY, MOD_WIND_AFFINITY, MOD_ICE_AFFINITY, MOD_THUNDER_AFFINITY, MOD_LIGHT_AFFINITY, MOD_DARK_AFFINITY};
weakAffinity = {MOD_WATER_AFFINITY, MOD_WIND_AFFINITY, MOD_THUNDER_AFFINITY, MOD_ICE_AFFINITY, MOD_FIRE_AFFINITY, MOD_EARTH_AFFINITY, MOD_DARK_AFFINITY, MOD_LIGHT_AFFINITY};
resistMod = {MOD_FIRERES, MOD_EARTHRES, MOD_WATERRES, MOD_WINDRES, MOD_ICERES, MOD_THUNDERRES, MOD_LIGHTRES, MOD_DARKRES};
defenseMod = {MOD_FIREDEF, MOD_EARTHDEF, MOD_WATERDEF, MOD_WINDDEF, MOD_ICEDEF, MOD_THUNDERDEF, MOD_LIGHTDEF, MOD_DARKDEF};
absorbMod = {MOD_FIRE_ABSORB, MOD_EARTH_ABSORB, MOD_WATER_ABSORB, MOD_WIND_ABSORB, MOD_ICE_ABSORB, MOD_LTNG_ABSORB, MOD_LIGHT_ABSORB, MOD_DARK_ABSORB};
nullMod = {MOD_FIRE_NULL, MOD_EARTH_NULL, MOD_WATER_NULL, MOD_WIND_NULL, MOD_ICE_NULL, MOD_LTNG_NULL, MOD_LIGHT_NULL, MOD_DARK_NULL};
blmMerit = {MERIT_FIRE_MAGIC_POTENCY, MERIT_EARTH_MAGIC_POTENCY, MERIT_WATER_MAGIC_POTENCY, MERIT_WIND_MAGIC_POTENCY, MERIT_ICE_MAGIC_POTENCY, MERIT_LIGHTNING_MAGIC_POTENCY};
rdmMerit = {MERIT_FIRE_MAGIC_ACCURACY, MERIT_EARTH_MAGIC_ACCURACY, MERIT_WATER_MAGIC_ACCURACY, MERIT_WIND_MAGIC_ACCURACY, MERIT_ICE_MAGIC_ACCURACY, MERIT_LIGHTNING_MAGIC_ACCURACY};
blmAMIIMerit = {MERIT_FLARE_II, MERIT_QUAKE_II, MERIT_FLOOD_II, MERIT_TORNADO_II, MERIT_FREEZE_II, MERIT_BURST_II};
-- USED FOR DAMAGING MAGICAL SPELLS (Stages 1 and 2 in Calculating Magic Damage on wiki)
--Calculates magic damage using the standard magic damage calc.
--Does NOT handle resistance.
-- Inputs:
-- V - The base damage of the spell
-- M - The INT multiplier of the spell
-- skilltype - The skill ID of the spell.
-- atttype - The attribute type (usually MOD_INT , except for things like Banish which is MOD_MND)
-- hasMultipleTargetReduction - true ifdamage is reduced on AoE. False otherwise (e.g. Charged Whisker vs -ga3 spells)
--
-- Output:
-- The total damage, before resistance and before equipment (so no HQ staff bonus worked out here).
SOFT_CAP = 60; --guesstimated
HARD_CAP = 120; --guesstimated
function calculateMagicDamage(V,M,player,spell,target,skilltype,atttype,hasMultipleTargetReduction)
local dint = player:getStat(atttype) - target:getStat(atttype);
local dmg = V;
if (dint<=0) then --ifdINT penalises, it's always M=1
dmg = dmg + dint;
if (dmg <= 0) then --dINT penalty cannot result in negative damage (target absorption)
return 0;
end
elseif (dint > 0 and dint <= SOFT_CAP) then --The standard calc, most spells hit this
dmg = dmg + (dint*M);
elseif (dint > 0 and dint > SOFT_CAP and dint < HARD_CAP) then --After SOFT_CAP, INT is only half effective
dmg = dmg + SOFT_CAP*M + ((dint-SOFT_CAP)*M)/2;
elseif (dint > 0 and dint > SOFT_CAP and dint >= HARD_CAP) then --After HARD_CAP, INT has no effect.
dmg = dmg + HARD_CAP*M;
end
if (skilltype == DIVINE_MAGIC_SKILL and target:isUndead()) then
-- 150% bonus damage
dmg = dmg * 1.5;
end
-- printf("dmg: %d dint: %d\n", dmg, dint);
return dmg;
end;
function doBoostGain(caster,target,spell,effect)
local duration = 300;
if (caster:hasStatusEffect(EFFECT_COMPOSURE) == true and caster:getID() == target:getID()) then
duration = duration * 3;
end
--calculate potency
local magicskill = target:getSkillLevel(ENHANCING_MAGIC_SKILL);
local potency = math.floor((magicskill - 300) / 10) + 5;
if (potency > 25) then
potency = 25;
elseif (potency < 5) then
potency = 5;
end
--printf("BOOST-GAIN: POTENCY = %d", potency);
--Only one Boost Effect can be active at once, so if the player has any we have to cancel & overwrite
local effectOverwrite = {80, 81, 82, 83, 84, 85, 86};
for i, effect in ipairs(effectOverwrite) do
--printf("BOOST-GAIN: CHECKING FOR EFFECT %d...",effect);
if (caster:hasStatusEffect(effect)) then
--printf("BOOST-GAIN: HAS EFFECT %d, DELETING...",effect);
caster:delStatusEffect(effect);
end
end
if (target:addStatusEffect(effect,potency,0,duration)) then
spell:setMsg(230);
else
spell:setMsg(75);
end
end;
function doEnspell(caster,target,spell,effect)
if (effect==EFFECT_BLOOD_WEAPON) then
target:addStatusEffect(EFFECT_BLOOD_WEAPON,1,0,30);
return;
end
local duration = 180;
if (caster:hasStatusEffect(EFFECT_COMPOSURE) == true and caster:getID() == target:getID()) then
duration = duration * 3;
end
--calculate potency
local magicskill = target:getSkillLevel(ENHANCING_MAGIC_SKILL);
local potency = 3 + math.floor((6*magicskill)/100);
if (magicskill>200) then
potency = 5 + math.floor((5*magicskill)/100);
end
if (target:addStatusEffect(effect,potency,0,duration)) then
spell:setMsg(230);
else
spell:setMsg(75);
end
end;
---------------------------------
-- getCurePower returns the caster's cure power
-- getCureFinal returns the final cure amount
-- Source: http://members.shaw.ca/pizza_steve/cure/Cure_Calculator.html
---------------------------------
function getCurePower(caster,isBlueMagic)
local MND = caster:getStat(MOD_MND);
local VIT = caster:getStat(MOD_VIT);
local skill = caster:getSkillLevel(HEALING_MAGIC_SKILL) + caster:getMod(MOD_HEALING);
local power = math.floor(MND/2) + math.floor(VIT/4) + skill;
return power;
end;
function getCurePowerOld(caster)
local MND = caster:getStat(MOD_MND);
local VIT = caster:getStat(MOD_VIT);
local skill = caster:getSkillLevel(HEALING_MAGIC_SKILL) + caster:getMod(MOD_HEALING);--it's healing magic skill for the BLU cures as well
local power = ((3 * MND) + VIT + (3 * math.floor(skill/5)));
return power;
end;
function getBaseCure(power,divisor,constant,basepower)
return ((power - basepower) / divisor) + constant;
end;
function getBaseCureOld(power,divisor,constant)
return (power / 2) / divisor + constant;
end;
function getCureFinal(caster,spell,basecure,minCure,isBlueMagic)
if (basecure < minCure) then
basecure = minCure;
end
local potency = 1 + (caster:getMod(MOD_CURE_POTENCY) / 100);
if (potency > 1.5) then
potency = 1.5;
end
local dSeal = 1;
if (caster:hasStatusEffect(EFFECT_DIVINE_SEAL)) then
dSeal = 2;
end
local rapture = 1;
if (isBlueMagic == false) then --rapture doesn't affect BLU cures as they're not white magic
if (caster:hasStatusEffect(EFFECT_RAPTURE)) then
local equippedHead = caster:getEquipID(SLOT_HEAD);
if (equippedHead == 11183) then
rapture = 1.55; --savant's bonnet +1
elseif (equippedHead == 11083) then
rapture = 1.6; --savant's bonnet +2
else
rapture = 1.5;
end
caster:delStatusEffectSilent(EFFECT_RAPTURE);
end
end
local dayWeatherBonus = 1;
local ele = spell:getElement();
local castersWeather = caster:getWeather();
local equippedMain = caster:getEquipID(SLOT_MAIN);
local equippedWaist = caster:getEquipID(SLOT_WAIST);
if (castersWeather == singleWeatherStrong[ele]) then
if (equippedMain == 18632 or equippedMain == 18633) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele]) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or equippedWaist == elementalObi[ele]) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (castersWeather == singleWeatherWeak[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele]) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
elseif (castersWeather == doubleWeatherStrong[ele]) then
if (equippedMain == 18632 or equippedMain == 18633) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele]) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or equippedWaist == elementalObi[ele]) then
dayWeatherBonus = dayWeatherBonus + 0.25;
end
elseif (castersWeather == doubleWeatherWeak[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele]) then
dayWeatherBonus = dayWeatherBonus - 0.25;
end
end
local dayElement = VanadielDayElement();
if (dayElement == dayStrong[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele]) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (dayElement == dayWeak[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele]) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
end
if (dayWeatherBonus > 1.35) then
dayWeatherBonus = 1.35;
end
local final = math.floor(math.floor(math.floor(math.floor(basecure) * potency) * dayWeatherBonus) * rapture) * dSeal;
return final;
end;
function getCureAsNukeFinal(caster,spell,power,divisor,constant,basepower)
return getCureFinal(caster,spell,power,divisor,constant,basepower);
end;
-----------------------------------
-- Returns the staff bonus for the caster and spell.
-----------------------------------
-- affinities that strengthen/weaken the index element
function AffinityBonus(caster,ele)
local bonus = 1.00;
local affinity = caster:getMod(strongAffinity[ele]) - caster:getMod(weakAffinity[ele]);
-- Iridal and Chatoyant will return affinity for strong and weak, cancelling their bonus out, so they need to be specifically checked.
-- Could do an if strong == weak, but that would cause problems once/if augments or magian gear is added.
local equippedMain = caster:getEquipID(SLOT_MAIN);
if (equippedMain == 18632) then
affinity = affinity + 1;
elseif (equippedMain == 18633) then
affinity = affinity + 2;
end
if (affinity > 0) then
bonus = bonus + 0.05 + 0.05 * affinity;
elseif (affinity < 0) then
bonus = bonus - 0.05 + 0.05 * affinity;
end
return bonus;
end;
-- USED FOR DAMAGING MAGICAL SPELLS. Stage 3 of Calculating Magic Damage on wiki
-- Reduces damage ifit resists.
--
-- Output:
-- The factor to multiply down damage (1/2 1/4 1/8 1/16) - In this format so this func can be used for enfeebs on duration.
function applyResistance(player,spell,target,diff,skill,bonus)
local resist = 1.0;
local magicaccbonus = 0;
local element = spell:getElement();
local castersWeather = player:getWeather();
if (bonus ~= nil) then
magicaccbonus = magicaccbonus + bonus;
end
if (skill == SINGING_SKILL and player:hasStatusEffect(EFFECT_TROUBADOUR)) then
if (math.random(0,99) < player:getMerit(MERIT_TROUBADOUR)-25) then
return 1.0;
end
end
--get the base acc (just skill plus magic acc mod)
local magicacc = player:getSkillLevel(skill) + player:getMod(79 + skill) + player:getMod(MOD_MACC) + player:getILvlMacc();
if player:hasStatusEffect(EFFECT_ALTRUISM) and spell:getSpellGroup() == SPELLGROUP_WHITE then
magicacc = magicacc + player:getStatusEffect(EFFECT_ALTRUISM):getPower();
end
if player:hasStatusEffect(EFFECT_FOCALIZATION) and spell:getSpellGroup() == SPELLGROUP_BLACK then
magicacc = magicacc + player:getStatusEffect(EFFECT_FOCALIZATION):getPower();
end
--difference in int/mnd
if (diff > 10) then
magicacc = magicacc + 10 + (diff - 10)/2;
else
magicacc = magicacc + diff;
end
--Add acc for dark seal
if (player:getStatusEffect(EFFECT_DARK_SEAL) ~= nil and skill == DARK_MAGIC_SKILL) then
magicaccbonus = magicaccbonus + 256;
end
--Add acc for klimaform
if (player:hasStatusEffect(EFFECT_KLIMAFORM) and (castersWeather == singleWeatherStrong[element] or castersWeather == doubleWeatherStrong[element])) then
magicaccbonus = magicaccbonus + 15;
end
if (element > ELE_NONE) then
-- Add acc for staves
local affinityBonus = AffinityBonus(player, element);
magicaccbonus = magicaccbonus + (affinityBonus-1) * 200;
end
--add acc for RDM group 1 merits
if (spell:getElement() > 0 and spell:getElement() <= 6) then
magicaccbonus = magicaccbonus + player:getMerit(rdmMerit[spell:getElement()]);
end
-- BLU mag acc merits - nuke acc is handled in bluemagic.lua. For the handful of BLU enfeebles that don't check a status resist (ie. dispel spells)
if (skill == BLUE_SKILL) then
magicaccbonus = magicaccbonus + player:getMerit(MERIT_MAGICAL_ACCURACY);
-- print(player:getMerit(MERIT_MAGICAL_ACCURACY))
end
local skillchainTier, skillchainCount = FormMagicBurst(element, target);
--add acc for BLM AMII spells
if (spell:getID() == 205 or spell:getID() == 207 or spell:getID() == 209 or spell:getID() == 211 or spell:getID() == 213 or spell:getID() == 215) then
if (player:getMerit(blmAMIIMerit[spell:getElement()]) ~= 0) then -- no bonus if the caster has zero merit investment - don't want to give them a negative bonus
magicaccbonus = magicaccbonus + (player:getMerit(blmAMIIMerit[spell:getElement()]) - 1) * 5; -- bonus value granted by merit is 1; subtract 1 since unlock doesn't give an accuracy bonus
-- print((player:getMerit(blmAMIIMerit[spell:getElement()]) - 1) * 5)
end
end
--add acc for skillchains
if (skillchainTier > 0) then
magicaccbonus = magicaccbonus + 25;
end
local resMod = 0; -- Some spells may possibly be non elemental, but could be resisted via meva.
if (element > ELE_NONE) then
resMod = target:getMod(resistMod[element]);
end
-- Base magic evasion (base magic evasion plus resistances(players), plus elemental defense(mobs)
local magiceva = target:getMod(MOD_MEVA) + resMod;
--get the difference of acc and eva, scale with level (3.33 at 10 to 0.44 at 75)
local multiplier = 0;
if player:getMainLvl() < 40 then
multiplier = 100 / 120;
else
multiplier = 100 / (player:getMainLvl() * 3);
end;
local p = (magicacc * multiplier) - (magiceva * 0.45);
magicaccbonus = magicaccbonus / 2;
--add magicacc bonus
p = p + magicaccbonus;
-- printf("acc: %f, eva: %f, bonus: %f, element: %u", magicacc, magiceva, magicaccbonus, element);
--double any acc over 50 if it's over 50
if (p > 5) then
p = 5 + (p - 5) * 2;
end
--add a flat bonus that won't get doubled in the previous step
p = p + 45;
--add a scaling bonus or penalty based on difference of targets level from caster
local leveldiff = player:getMainLvl() - target:getMainLvl();
if (leveldiff < 0) then
p = p - (25 * ( (player:getMainLvl()) / 75 )) + leveldiff;
else
p = p + (25 * ( (player:getMainLvl()) / 75 )) + leveldiff;
end
--cap accuracy
if (p > 95) then
p = 95;
elseif (p < 5) then
p = 5;
end
p = p / 100;
-- Resistance thresholds based on p. A higher p leads to lower resist rates, and a lower p leads to higher resist rates.
local half = (1 - p);
local quart = ((1 - p)^2);
local eighth = ((1 - p)^3);
local sixteenth = ((1 - p)^4);
-- print("HALF:",half);
-- print("QUART:",quart);
-- print("EIGHTH:",eighth);
-- print("SIXTEENTH:",sixteenth);
local resvar = math.random();
-- Determine final resist based on which thresholds have been crossed.
if (resvar <= sixteenth) then
resist = 0.0625;
--printf("Spell resisted to 1/16!!! Threshold = %u",sixteenth);
elseif (resvar <= eighth) then
resist = 0.125;
--printf("Spell resisted to 1/8! Threshold = %u",eighth);
elseif (resvar <= quart) then
resist = 0.25;
--printf("Spell resisted to 1/4. Threshold = %u",quart);
elseif (resvar <= half) then
resist = 0.5;
--printf("Spell resisted to 1/2. Threshold = %u",half);
else
resist = 1.0;
--printf("1.0");
end
return resist;
end;
-- USED FOR Status Effect Enfeebs (blind, slow, para, etc.)
-- Output:
-- The factor to multiply down duration (1/2 1/4 1/8 1/16)
function applyResistanceEffect(player,spell,target,diff,skill,bonus,effect)
-- resist everything if magic shield is active
if (target:hasStatusEffect(EFFECT_MAGIC_SHIELD, 0)) then
return 0;
end
-- If Stymie is active, as long as the mob is not immune then the effect is not resisted
if (player:hasStatusEffect(EFFECT_STYMIE) and target:canGainStatusEffect(effect)) then
player:delStatusEffect(EFFECT_STYMIE);
return 1;
end
local resist = 1.0;
local magicaccbonus = 0;
local element = spell:getElement();
if (bonus ~= nil) then
magicaccbonus = magicaccbonus + bonus;
end
if (skill == SINGING_SKILL and player:hasStatusEffect(EFFECT_TROUBADOUR)) then
if (math.random(0,99) < player:getMerit(MERIT_TROUBADOUR)-25) then
return 1.0;
end
end
-- Get the base acc (just skill + skill mod (79 + skillID = ModID) + magic acc mod)
local magicacc = player:getSkillLevel(skill) + player:getMod(79 + skill) + player:getMod(MOD_MACC);
if player:hasStatusEffect(EFFECT_ALTRUISM) and spell:getSpellGroup() == SPELLGROUP_WHITE then
magicacc = magicacc + player:getStatusEffect(EFFECT_ALTRUISM):getPower();
end
if player:hasStatusEffect(EFFECT_FOCALIZATION) and spell:getSpellGroup() == SPELLGROUP_BLACK then
magicacc = magicacc + player:getStatusEffect(EFFECT_FOCALIZATION):getPower();
end
--difference in int/mnd
if (diff > 10) then
magicacc = magicacc + 10 + (diff - 10)/2;
else
magicacc = magicacc + diff;
end
--add acc for ele/dark seal
if (player:getStatusEffect(EFFECT_DARK_SEAL) ~= nil and skill == DARK_MAGIC_SKILL) then
magicaccbonus = magicaccbonus + 256;
end
if (element > ELE_NONE) then
-- Add acc for staves
local affinityBonus = AffinityBonus(player, element);
magicaccbonus = magicaccbonus + (affinityBonus-1) * 200;
end
--add acc for RDM group 1 merits
if (spell:getElement() > 0 and spell:getElement() <= 6) then
magicaccbonus = magicaccbonus + player:getMerit(rdmMerit[spell:getElement()]);
end
-- BLU mag acc merits - nuke acc is handled in bluemagic.lua
if (skill == BLUE_SKILL) then
magicaccbonus = magicaccbonus + player:getMerit(MERIT_MAGICAL_ACCURACY);
-- print(player:getMerit(MERIT_MAGICAL_ACCURACY))
end
local skillchainTier, skillchainCount = FormMagicBurst(element, target);
--add acc for skillchains
if (skillchainTier > 0) then
magicaccbonus = magicaccbonus + 25;
end
local resMod = 0; -- Some spells may possibly be non elemental, but have status effects.
if (element > ELE_NONE) then
resMod = target:getMod(resistMod[element]);
end
-- Base magic evasion (base magic evasion plus resistances(players), plus elemental defense(mobs)
local magiceva = target:getMod(MOD_MEVA) + resMod;
--get the difference of acc and eva, scale with level (3.33 at 10 to 0.44 at 75)
local multiplier = 0;
if player:getMainLvl() < 40 then
multiplier = 100 / 120;
else
multiplier = 100 / (player:getMainLvl() * 3);
end;
local p = (magicacc * multiplier) - (magiceva * 0.45);
magicaccbonus = magicaccbonus / 2;
--add magicacc bonus
p = p + magicaccbonus;
-- printf("acc: %f, eva: %f, bonus: %f, element: %u", magicacc, magiceva, magicaccbonus, element);
--double any acc over 50 if it's over 50
if (p > 5) then
p = 5 + (p - 5) * 2;
end
--add a flat bonus that won't get doubled in the previous step
p = p + 45;
--add a scaling bonus or penalty based on difference of targets level from caster
local leveldiff = player:getMainLvl() - target:getMainLvl();
if (leveldiff < 0) then
p = p - (25 * ( (player:getMainLvl()) / 75 )) + leveldiff;
else
p = p + (25 * ( (player:getMainLvl()) / 75 )) + leveldiff;
end
-- add effect resistence
if (effect ~= nil and effect > 0) then
local effectres = 0;
if (effect == EFFECT_SLEEP_I or effect == EFFECT_SLEEP_II or effect == EFFECT_LULLABY) then
effectres = MOD_SLEEPRES;
elseif (effect == EFFECT_POISON) then
effectres = MOD_POISONRES;
elseif (effect == EFFECT_PARALYZE) then
effectres = MOD_PARALYZERES;
elseif (effect == EFFECT_BLINDNESS) then
effectres = MOD_BLINDRES
elseif (effect == EFFECT_SILENCE) then
effectres = MOD_SILENCERES;
elseif (effect == EFFECT_PLAGUE or effect == EFFECT_DISEASE) then
effectres = MOD_VIRUSRES;
elseif (effect == EFFECT_PETRIFICATION) then
effectres = MOD_PETRIFYRES;
elseif (effect == EFFECT_BIND) then
effectres = MOD_BINDRES;
elseif (effect == EFFECT_CURSE_I or effect == EFFECT_CURSE_II or effect == EFFECT_BANE) then
effectres = MOD_CURSERES;
elseif (effect == EFFECT_WEIGHT) then
effectres = MOD_GRAVITYRES;
elseif (effect == EFFECT_SLOW) then
effectres = MOD_SLOWRES;
elseif (effect == EFFECT_STUN) then
effectres = MOD_STUNRES;
elseif (effect == EFFECT_CHARM) then
effectres = MOD_CHARMRES;
elseif (effect == EFFECT_AMNESIA) then
effectres = MOD_AMNESIARES;
end
if (effectres > 0) then
p = p - target:getMod(effectres);
end
end
--cap accuracy
if (p > 95) then
p = 95;
elseif (p < 5) then
p = 5;
end
p = p / 100;
-- Resistance thresholds based on p. A higher p leads to lower resist rates, and a lower p leads to higher resist rates.
half = (1 - p);
quart = half^2;
eighth = half^3;
sixteenth = half^4;
-- printf("HALF: %f", half);
-- printf("QUART: %f", quart);
-- printf("EIGHTH: %f", eighth);
-- printf("SIXTEENTH: %f", sixteenth);
local resvar = math.random();
-- Determine final resist based on which thresholds have been crossed.
if (resvar <= sixteenth) then
resist = 0.0625;
--printf("Spell resisted to 1/16!!! Threshold = %u",sixteenth);
elseif (resvar <= eighth) then
resist = 0.125;
--printf("Spell resisted to 1/8! Threshold = %u",eighth);
elseif (resvar <= quart) then
resist = 0.25;
--printf("Spell resisted to 1/4. Threshold = %u",quart);
elseif (resvar <= half) then
resist = 0.5;
--printf("Spell resisted to 1/2. Threshold = %u",half);
else
resist = 1.0;
--printf("1.0");
end
return resist;
end;
--Applies resistance for things that may not be spells - ie. Quick Draw
function applyResistanceAbility(player,target,element,skill,bonus)
local resist = 1.0;
local magicaccbonus = 0;
if (bonus ~= nil) then
magicaccbonus = magicaccbonus + bonus;
end
--get the base acc (just skill plus magic acc mod)
local magicacc = player:getSkillLevel(skill) + player:getMod(79 + skill) + player:getMod(MOD_MACC);
if (element > ELE_NONE) then
--add acc for staves
local affinityBonus = AffinityBonus(player, element);
magicaccbonus = magicaccbonus + (affinityBonus-1) * 200;
end
--base magic evasion (base magic evasion plus resistances(players), plus elemental defense(mobs)
local magiceva = target:getMod(MOD_MEVA);
if (element > ELE_NONE) then
magiceva = magiceva + target:getMod(resistMod[element]);
end
--get the difference of acc and eva, scale with level (3.33 at 10 to 0.44 at 75)
local multiplier = 0;
if player:getMainLvl() < 40 then
multiplier = 100 / 120;
else
multiplier = 100 / (player:getMainLvl() * 3);
end;
local p = (magicacc * multiplier) - (magiceva * 0.45);
magicaccbonus = magicaccbonus / 2;
--add magicacc bonus
p = p + magicaccbonus;
-- printf("acc: %f, eva: %f, bonus: %f", magicacc, magiceva, magicaccbonus);
--double any acc over 50 if it's over 50
if (p > 5) then
p = 5 + (p - 5) * 2;
end
--add a flat bonus that won't get doubled in the previous step
p = p + 45;
--add a scaling bonus or penalty based on difference of targets level from caster
local leveldiff = player:getMainLvl() - target:getMainLvl();
if (leveldiff < 0) then
p = p - (25 * ( (player:getMainLvl()) / 75 )) + leveldiff;
else
p = p + (25 * ( (player:getMainLvl()) / 75 )) + leveldiff;
end
--cap accuracy
if (p > 95) then
p = 95;
elseif (p < 5) then
p = 5;
end
p = p / 100;
-- Resistance thresholds based on p. A higher p leads to lower resist rates, and a lower p leads to higher resist rates.
local half = (1 - p);
local quart = ((1 - p)^2);
local eighth = ((1 - p)^3);
local sixteenth = ((1 - p)^4);
-- print("HALF:",half);
-- print("QUART:",quart);
-- print("EIGHTH:",eighth);
-- print("SIXTEENTH:",sixteenth);
local resvar = math.random();
-- Determine final resist based on which thresholds have been crossed.
if (resvar <= sixteenth) then
resist = 0.0625;
--printf("Spell resisted to 1/16!!! Threshold = %u",sixteenth);
elseif (resvar <= eighth) then
resist = 0.125;
--printf("Spell resisted to 1/8! Threshold = %u",eighth);
elseif (resvar <= quart) then
resist = 0.25;
--printf("Spell resisted to 1/4. Threshold = %u",quart);
elseif (resvar <= half) then
resist = 0.5;
--printf("Spell resisted to 1/2. Threshold = %u",half);
else
resist = 1.0;
--printf("1.0");
end
return resist;
end;
--Applies resistance for additional effects
function applyResistanceAddEffect(player,target,element,bonus)
local resist = 1.0;
local magicaccbonus = 0;
if (bonus ~= nil) then
magicaccbonus = magicaccbonus + bonus;
end
--get the base acc (just skill plus magic acc mod)
local magicacc = 0;
--add acc for staves
local affinityBonus = AffinityBonus(player, element);
magicaccbonus = magicaccbonus + (affinityBonus-1) * 200;
--base magic evasion (base magic evasion plus resistances(players), plus elemental defense(mobs)
local magiceva = target:getMod(resistMod[element]);
--get the difference of acc and eva, scale with level (3.33 at 10 to 0.44 at 75)
local multiplier = 0;
if player:getMainLvl() < 40 then
multiplier = 100 / 120;
else
multiplier = 100 / (player:getMainLvl() * 3);
end;
local p = (magicacc * multiplier) - (magiceva * 0.45);
magicaccbonus = magicaccbonus / 2;
--add magicacc bonus
p = p + magicaccbonus;
--printf("acc: %f, eva: %f, bonus: %f", magicacc, magiceva, magicaccbonus);
--add a flat bonus that won't get doubled in the previous step
p = p + 75;
--add a scaling bonus or penalty based on difference of targets level from caster
local leveldiff = player:getMainLvl() - target:getMainLvl();
--[[if (leveldiff < 0) then
p = p - (25 * ( (player:getMainLvl()) / 75 )) + leveldiff;
else
p = p + (25 * ( (player:getMainLvl()) / 75 )) + leveldiff;
end]]
p = p + leveldiff*2;
--cap accuracy
if (p > 95) then
p = 95;
elseif (p < 5) then
p = 5;
end
p = p / 100;
-- Resistance thresholds based on p. A higher p leads to lower resist rates, and a lower p leads to higher resist rates.
local half = (1 - p);
local quart = ((1 - p)^2);
local eighth = ((1 - p)^3);
local sixteenth = ((1 - p)^4);
--print("HALF: "..half);
--print("QUART: "..quart);
--print("EIGHTH: "..eighth);
--print("SIXTEENTH: "..sixteenth);
local resvar = math.random();
-- Determine final resist based on which thresholds have been crossed.
if (resvar <= sixteenth) then
resist = 0.0625;
--printf("Spell resisted to 1/16!!! Threshold = %u",sixteenth);
elseif (resvar <= eighth) then
resist = 0.125;
--printf("Spell resisted to 1/8! Threshold = %u",eighth);
elseif (resvar <= quart) then
resist = 0.25;
--printf("Spell resisted to 1/4. Threshold = %u",quart);
elseif (resvar <= half) then
resist = 0.5;
--printf("Spell resisted to 1/2. Threshold = %u",half);
else
resist = 1.0;
--printf("1.0");
end
return resist;
end;
-----------------------------------
-- SKILL LEVEL CALCULATOR
-- Returns a skill level based on level and rating.
--
-- See the translation of aushacho's work by Themanii:
-- http://home.comcast.net/~themanii/skill.html
--
-- The arguments are skill rank (numerical), and level. 1 is A+, 2 is A-, and so on.
-----------------------------------
function getSkillLvl(rank,level)
local skill = 0; --Failsafe
if (level <= 50) then --Levels 1-50
if (rank == 1 or rank == 2) then --A-Rated Skill
skill = (((level-1)*3)+6);
elseif (rank == 3 or rank == 4 or rank == 5) then --B-Rated Skill
skill = (((level-1)*2.9)+5);
elseif (rank == 6 or rank == 7 or rank == 8) then --C-Rated Skill
skill = (((level-1)*2.8)+5);
elseif (rank == 9) then --D-Rated Skill
skill = (((level-1)*2.7)+4);
elseif (rank == 10) then --E-Rated Skill
skill = (((level-1)*2.5)+4);
elseif (rank == 11) then --F-Rated Skill
skill = (((level-1)*2.3)+4);
end
elseif (level > 50 and level <= 60) then --Levels 51-60
if (rank == 1 or rank == 2) then --A-Rated Skill
skill = (((level-50)*5)+153);
elseif (rank == 3 or rank == 4 or rank == 5) then --B-Rated Skill
skill = (((level-50)*4.9)+147);
elseif (rank == 6 or rank == 7 or rank == 8) then --C-Rated Skill
skill = (((level-50)*4.8)+142);
elseif (rank == 9) then --D-Rated Skill
skill = (((level-50)*4.7)+136);
elseif (rank == 10) then --E-Rated Skill
skill = (((level-50)*4.5)+126);
elseif (rank == 11) then --F-Rated Skill
skill = (((level-50)*4.3)+116);
end
elseif (level > 60 and level <= 70) then --Levels 61-70
if (rank == 1) then --A+ Rated Skill
skill = (((level-60)*4.85)+203);
elseif (rank == 2) then --A- Rated Skill
skill = (((level-60)*4.10)+203);
elseif (rank == 3) then --B+ Rated Skill
skill = (((level-60)*3.70)+196);
elseif (rank == 4) then --B Rated Skill
skill = (((level-60)*3.23)+196);
elseif (rank == 5) then --B- Rated Skill
skill = (((level-60)*2.70)+196);
elseif (rank == 6) then --C+ Rated Skill
skill = (((level-60)*2.50)+190);
elseif (rank == 7) then --C Rated Skill
skill = (((level-60)*2.25)+190);
elseif (rank == 8) then --C- Rated Skill
skill = (((level-60)*2.00)+190);
elseif (rank == 9) then --D Rated Skill
skill = (((level-60)*1.85)+183);
elseif (rank == 10) then --E Rated Skill
skill = (((level-60)*1.95)+171);
elseif (rank == 11) then --F Rated Skill
skill = (((level-60)*2.05)+159);
end
else --Level 71 and above
if (rank == 1) then --A+ Rated Skill
skill = (((level-70)*5)+251);
elseif (rank == 2) then --A- Rated Skill
skill = (((level-70)*5)+244);
elseif (rank == 3) then --B+ Rated Skill
skill = (((level-70)*3.70)+233);
elseif (rank == 4) then --B Rated Skill
skill = (((level-70)*3.23)+228);
elseif (rank == 5) then --B- Rated Skill
skill = (((level-70)*2.70)+223);
elseif (rank == 6) then --C+ Rated Skill
skill = (((level-70)*3)+215);
elseif (rank == 7) then --C Rated Skill
skill = (((level-70)*2.6)+212);
elseif (rank == 8) then --C- Rated Skill
skill = (((level-70)*2.00)+210);
elseif (rank == 9) then --D Rated Skill
skill = (((level-70)*1.85)+201);
elseif (rank == 10) then --E Rated Skill
skill = (((level-70)*1.95)+190);
elseif (rank == 11) then --F Rated Skill
skill = (((level-70)*2)+179);
end
end
return skill;
end;
function handleAfflatusMisery(caster, spell, dmg)
if (caster:hasStatusEffect(EFFECT_AFFLATUS_MISERY)) then
local misery = caster:getMod(MOD_AFFLATUS_MISERY);
--BGwiki puts the boost capping at 200% bonus at around 300hp
if (misery > 300) then
misery = 300;
end;
--So, if wee capped at 300, we'll make the boost it boost 2x (200% damage)
local boost = 1 + (misery / 300);
local preboost = dmg;
dmg = math.floor(dmg * boost);
--printf("AFFLATUS MISERY: Boosting %d -> %f, Final %d", preboost, boost, dmg);
--Afflatus Mod is Used Up...
caster:setMod(MOD_AFFLATUS_MISERY, 0)
end
return dmg;
end;
function finalMagicAdjustments(caster,target,spell,dmg)
--Handles target's HP adjustment and returns UNSIGNED dmg (absorb message is set in this function)
-- handle multiple targets
if (caster:isSpellAoE(spell:getID())) then
local total = spell:getTotalTargets();
if (total > 9) then
-- ga spells on 10+ targets = 0.4
dmg = dmg * 0.4;
elseif (total > 1) then
-- -ga spells on 2 to 9 targets = 0.9 - 0.05T where T = number of targets
dmg = dmg * (0.9 - 0.05 * total);
end
-- kill shadows
-- target:delStatusEffect(EFFECT_COPY_IMAGE);
-- target:delStatusEffect(EFFECT_BLINK);
else
-- this logic will eventually be moved here
-- dmg = utils.takeShadows(target, dmg, 1);
-- if (dmg == 0) then
-- spell:setMsg(31);
-- return 1;
-- end
end
dmg = target:magicDmgTaken(dmg);
if (dmg > 0) then
dmg = dmg - target:getMod(MOD_PHALANX);
utils.clamp(dmg, 0, 99999);
end
--handling stoneskin
dmg = utils.stoneskin(target, dmg);
dmg = utils.clamp(dmg, -99999, 99999);
if (dmg < 0) then
dmg = target:addHP(-dmg);
spell:setMsg(7);
else
target:delHP(dmg);
target:updateEnmityFromDamage(caster,dmg);
-- Only add TP if the target is a mob
if (target:getObjType() ~= TYPE_PC) then
target:addTP(10);
end
end
return dmg;
end;
function finalMagicNonSpellAdjustments(caster,target,ele,dmg)
--Handles target's HP adjustment and returns SIGNED dmg (negative values on absorb)
dmg = target:magicDmgTaken(dmg);
if (dmg > 0) then
dmg = dmg - target:getMod(MOD_PHALANX);
utils.clamp(dmg, 0, 99999);
end
--handling stoneskin
dmg = utils.stoneskin(target, dmg);
dmg = utils.clamp(dmg, -99999, 99999);
if (dmg < 0) then
dmg = -(target:addHP(-dmg));
else
target:delHP(dmg);
end
--Not updating enmity from damage, as this is primarily used for additional effects (which don't generate emnity)
-- in the case that updating enmity is needed, do it manually after calling this
--target:updateEnmityFromDamage(caster,dmg);
return dmg;
end;
function adjustForTarget(target,dmg,ele)
if (dmg > 0 and math.random(0,99) < target:getMod(absorbMod[ele])) then
return -dmg;
end
if (math.random(0,99) < target:getMod(nullMod[ele])) then
return 0;
end
--Moved non element specific absorb and null mod checks to core
--TODO: update all lua calls to magicDmgTaken with appropriate element and remove this function
return dmg;
end;
function calculateMagicBurst(caster, spell, target)
local burst = 1.0;
if (spell:getSpellGroup() == 3 and not caster:hasStatusEffect(EFFECT_BURST_AFFINITY)) then
return burst;
end
local skillchainTier, skillchainCount = FormMagicBurst(spell:getElement(), target);
if (skillchainTier > 0) then
if (skillchainCount == 1) then
burst = 1.3;
elseif (skillchainCount == 2) then
burst = 1.35;
elseif (skillchainCount == 3) then
burst = 1.40;
elseif (skillchainCount == 4) then
burst = 1.45;
elseif (skillchainCount == 5) then
burst = 1.50;
else
-- Something strange is going on if this occurs.
burst = 1.0;
end
--add burst bonus for BLM AMII spells
if (spell:getID() == 205 or spell:getID() == 207 or spell:getID() == 209 or spell:getID() == 211 or spell:getID() == 213 or spell:getID() == 215) then
if (caster:getMerit(blmAMIIMerit[spell:getElement()]) ~= 0) then -- no bonus if the caster has zero merit investment - don't want to give them a negative bonus
burst = burst + (caster:getMerit(blmAMIIMerit[spell:getElement()]) - 1) * 0.03; -- bonus value granted by merit is 1; subtract 1 since unlock doesn't give a magic burst bonus
-- print((caster:getMerit(blmAMIIMerit[spell:getElement()]) - 1) * 0.03)
end
end
end
-- Add in Magic Burst Bonus Modifier
if (burst > 1) then
burst = burst + (caster:getMod(MOD_MAG_BURST_BONUS) / 100);
end
return burst;
end;
function addBonuses(caster, spell, target, dmg, bonusmab)
local ele = spell:getElement();
local affinityBonus = AffinityBonus(caster, spell:getElement());
dmg = math.floor(dmg * affinityBonus);
if (bonusmab == nil) then
bonusmab = 0;
end
local speciesReduction = target:getMod(defenseMod[ele]);
speciesReduction = 1.00 - (speciesReduction/1000);
dmg = math.floor(dmg * speciesReduction);
local dayWeatherBonus = 1.00;
local equippedMain = caster:getEquipID(SLOT_MAIN);
local equippedWaist = caster:getEquipID(SLOT_WAIST);
local weather = caster:getWeather();
if (weather == singleWeatherStrong[ele]) then
-- Iridescence
if (equippedMain == 18632 or equippedMain == 18633) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (caster:getWeather() == singleWeatherWeak[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
elseif (weather == doubleWeatherStrong[ele]) then
-- Iridescence
if (equippedMain == 18632 or equippedMain == 18633) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.25;
end
elseif (weather == doubleWeatherWeak[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus - 0.25;
end
end
local dayElement = VanadielDayElement();
if (dayElement == dayStrong[ele]) then
local equippedLegs = caster:getEquipID(SLOT_LEGS);
if (equippedLegs == 15120 or equippedLegs == 15583) then
dayWeatherBonus = dayWeatherBonus + 0.05;
end
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (dayElement == dayWeak[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] or isHelixSpell(spell)) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if dayWeatherBonus > 1.35 then
dayWeatherBonus = 1.35;
end
dmg = math.floor(dmg * dayWeatherBonus);
local burst = calculateMagicBurst(caster, spell, target);
if (burst > 1.0) then
spell:setMsg(spell:getMagicBurstMessage()); -- "Magic Burst!"
end
dmg = math.floor(dmg * burst);
local mabbonus = 0;
if (spell:getID() >= 245 and spell:getID() <= 248) then -- Drain/Aspir (II)
mabbonus = 1 + caster:getMod(MOD_ENH_DRAIN_ASPIR)/100;
-- print(mabbonus);
else
local mab = caster:getMod(MOD_MATT) + bonusmab;
if (spell:getElement() > 0 and spell:getElement() <= 6) then
mab = mab + caster:getMerit(blmMerit[spell:getElement()]);
end
mabbonus = (100 + mab) / (100 + target:getMod(MOD_MDEF));
end
if (mabbonus < 0) then
mabbonus = 0;
end
dmg = math.floor(dmg * mabbonus);
if (caster:hasStatusEffect(EFFECT_EBULLIENCE)) then
local equippedHead = caster:getEquipID(SLOT_HEAD);
if (equippedHead == 11183) then
dmg = dmg * 1.25; --savant's bonnet +1
elseif (equippedHead == 11083) then
dmg = dmg * 1.3; --savant's bonnet +2
else
dmg = dmg * 1.2;
end
caster:delStatusEffectSilent(EFFECT_EBULLIENCE);
end
dmg = math.floor(dmg);
-- print(affinityBonus);
-- print(speciesReduction);
-- print(dayWeatherBonus);
-- print(burst);
-- print(mab);
-- print(magicDmgMod);
return dmg;
end;
function addBonusesAbility(caster, ele, target, dmg, params)
local affinityBonus = AffinityBonus(caster, ele);
dmg = math.floor(dmg * affinityBonus);
local speciesReduction = target:getMod(defenseMod[ele]);
speciesReduction = 1.00 - (speciesReduction/1000);
dmg = math.floor(dmg * speciesReduction);
local dayWeatherBonus = 1.00;
local equippedMain = caster:getEquipID(SLOT_MAIN);
local equippedWaist = caster:getEquipID(SLOT_WAIST);
local weather = caster:getWeather();
if (weather == singleWeatherStrong[ele]) then
-- Iridescence
if (equippedMain == 18632 or equippedMain == 18633) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (caster:getWeather() == singleWeatherWeak[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] ) then
dayWeatherBonus = dayWeatherBonus - 0.10;
end
elseif (weather == doubleWeatherStrong[ele]) then
-- Iridescence
if (equippedMain == 18632 or equippedMain == 18633) then
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then
dayWeatherBonus = dayWeatherBonus + 0.25;
end
elseif (weather == doubleWeatherWeak[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] ) then
dayWeatherBonus = dayWeatherBonus - 0.25;
end
end
local dayElement = VanadielDayElement();
if (dayElement == dayStrong[ele]) then
local equippedLegs = caster:getEquipID(SLOT_LEGS);
if (equippedLegs == 15120 or equippedLegs == 15583) then
dayWeatherBonus = dayWeatherBonus + 0.05;
end
if (math.random() < 0.33 or equippedWaist == elementalObi[ele] ) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
elseif (dayElement == dayWeak[ele]) then
if (math.random() < 0.33 or equippedWaist == elementalObiWeak[ele] ) then
dayWeatherBonus = dayWeatherBonus + 0.10;
end
end
if dayWeatherBonus > 1.35 then
dayWeatherBonus = 1.35;
end
dmg = math.floor(dmg * dayWeatherBonus);
local mab = 1;
if (params ~= nil and params.bonusmab ~= nil and params.includemab == true) then
mab = (100 + caster:getMod(MOD_MATT) + params.bonusmab) / (100 + target:getMod(MOD_MDEF));
elseif (params == nil or (params ~= nil and params.includemab == true)) then
mab = (100 + caster:getMod(MOD_MATT)) / (100 + target:getMod(MOD_MDEF));
end
if (mab < 0) then
mab = 0;
end
dmg = math.floor(dmg * mab);
-- print(affinityBonus);
-- print(speciesReduction);
-- print(dayWeatherBonus);
-- print(burst);
-- print(mab);
-- print(magicDmgMod);
return dmg;
end;
---------------------------------------------------------------------
-- Elemental Debuff Potency functions
---------------------------------------------------------------------
function getElementalDebuffDOT(INT)
local DOT = 0;
if (INT<= 39) then
DOT = 1;
elseif (INT <= 69) then
DOT = 2;
elseif (INT <= 99) then
DOT = 3;
elseif (INT <= 149) then
DOT = 4;
else
DOT = 5;
end
return DOT;
end;
function getElementalDebuffStatDownFromDOT(dot)
local stat_down = 0;
if (dot == 1) then
stat_down = 5;
elseif (dot == 2) then
stat_down = 7;
elseif (dot == 3) then
stat_down = 9;
elseif (dot == 4) then
stat_down = 11;
else
stat_down = 13;
end
return stat_down;
end;
function getHelixDuration(caster)
--Dark Arts will further increase Helix duration, but testing is ongoing.
local casterLevel = caster:getMainLvl();
local duration = 30; --fallthrough
if (casterLevel <= 39) then
duration = 30;
elseif (casterLevel <= 59) then
duration = 60;
elseif (casterLevel <= 99) then
duration = 90;
end
return duration;
end;
function isHelixSpell(spell)
--Dark Arts will further increase Helix duration, but testing is ongoing.
local id = spell:getID();
if id >= 278 and id <= 285 then
return true;
end
return false;
end;
function handleThrenody(caster, target, spell, basePower, baseDuration, modifier)
-- Process resitances
local staff = AffinityBonus(caster, spell:getElement());
-- print("staff=" .. staff);
local dCHR = (caster:getStat(MOD_CHR) - target:getStat(MOD_CHR));
-- print("dCHR=" .. dCHR);
local resm = applyResistance(caster, spell, target, dCHR, SINGING_SKILL, staff);
-- print("rsem=" .. resm);
if (resm < 0.5) then
-- print("resm resist");
spell:setMsg(85);
return EFFECT_THRENODY;
end
-- Remove previous Threnody
target:delStatusEffect(EFFECT_THRENODY);
local iBoost = caster:getMod(MOD_THRENODY_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT);
local power = basePower + iBoost*5;
local duration = baseDuration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1);
if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then
power = power * 2;
elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then
power = power * 1.5;
end
if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then
duration = duration * 2;
end
-- Set spell message and apply status effect
target:addStatusEffect(EFFECT_THRENODY, power, 0, duration, 0, modifier, 0);
return EFFECT_THRENODY;
end;
function handleNinjutsuDebuff(caster, target, spell, basePower, baseDuration, modifier)
-- Add new
target:addStatusEffectEx(EFFECT_NINJUTSU_ELE_DEBUFF, 0, basePower, 0, baseDuration, 0, modifier, 0);
return EFFECT_NINJUTSU_ELE_DEBUFF;
end;
-- Returns true if you can overwrite the effect
-- Example: canOverwrite(target, EFFECT_SLOW, 25)
function canOverwrite(target, effect, power, mod)
mod = mod or 1;
local statusEffect = target:getStatusEffect(effect);
-- effect not found so overwrite
if (statusEffect == nil) then
return true;
end
-- overwrite if its weaker
if (statusEffect:getPower()*mod > power) then
return false;
end
return true;
end
function doElementalNuke(caster, spell, target, spellParams)
local DMG = 0;
local V = 0;
local M = 0;
local dINT = caster:getStat(MOD_INT) - target:getStat(MOD_INT);
local hasMultipleTargetReduction = spellParams.hasMultipleTargetReduction; --still unused!!!
local resistBonus = spellParams.resistBonus;
local mDMG = caster:getMod(MOD_MAGIC_DAMAGE);
--[[
Calculate base damage:
D = mDMG + V + (dINT × M)
D is then floored
For dINT reduce by amount factored into the V value (example: at 134 INT, when using V100 in the calculation, use dINT = 134-100 = 34)
]]
if (dINT <= 49) then
V = spellParams.V0;
M = spellParams.M0;
DMG = math.floor(DMG + mDMG + V + (dINT * M));
if (DMG <= 0) then
return 0;
end
elseif (dINT >= 50 and dINT <= 99) then
V = spellParams.V50;
M = spellParams.M50;
DMG = math.floor(DMG + mDMG + V + ((dINT - 50) * M));
elseif (dINT >= 100 and dINT <= 199) then
V = spellParams.V100;
M = spellParams.M100;
DMG = math.floor(DMG + mDMG + V + ((dINT - 100) * M));
elseif (dINT > 199) then
V = spellParams.V200;
M = spellParams.M200;
DMG = math.floor(DMG + mDMG + V + ((dINT - 200) * M));
end
--get resist multiplier (1x if no resist)
local diff = caster:getStat(MOD_INT) - target:getStat(MOD_INT);
local resist = applyResistance(caster, spell, target, diff, ELEMENTAL_MAGIC_SKILL, resistBonus);
--get the resisted damage
DMG = DMG * resist;
--add on bonuses (staff/day/weather/jas/mab/etc all go in this function)
DMG = addBonuses(caster, spell, target, DMG);
--add in target adjustment
local ele = spell:getElement();
DMG = adjustForTarget(target, DMG, ele);
--add in final adjustments
DMG = finalMagicAdjustments(caster, target, spell, DMG);
return DMG;
end
function doDivineNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus)
return doNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,DIVINE_MAGIC_SKILL,MOD_MND);
end
function doNinjutsuNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,mabBonus)
return doNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,NINJUTSU_SKILL,MOD_INT,mabBonus);
end
function doNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus,skill,modStat,mabBonus)
--calculate raw damage
local dmg = calculateMagicDamage(V,M,caster,spell,target,skill,modStat,hasMultipleTargetReduction);
--get resist multiplier (1x if no resist)
local resist = applyResistance(caster,spell,target,caster:getStat(modStat)-target:getStat(modStat),skill,resistBonus);
--get the resisted damage
dmg = dmg*resist;
if (skill == NINJUTSU_SKILL) then
-- boost with Futae
if (caster:hasStatusEffect(EFFECT_FUTAE)) then
dmg = math.floor(dmg * 1.50);
caster:delStatusEffect(EFFECT_FUTAE);
end
end
--add on bonuses (staff/day/weather/jas/mab/etc all go in this function)
dmg = addBonuses(caster,spell,target,dmg,mabBonus);
--add in target adjustment
dmg = adjustForTarget(target,dmg,spell:getElement());
--add in final adjustments
dmg = finalMagicAdjustments(caster,target,spell,dmg);
return dmg;
end
function doDivineBanishNuke(V,M,caster,spell,target,hasMultipleTargetReduction,resistBonus)
local skill = DIVINE_MAGIC_SKILL;
local modStat = MOD_MND;
--calculate raw damage
local dmg = calculateMagicDamage(V,M,caster,spell,target,skill,modStat,hasMultipleTargetReduction);
--get resist multiplier (1x if no resist)
local resist = applyResistance(caster,spell,target,caster:getStat(modStat)-target:getStat(modStat),skill,resistBonus);
--get the resisted damage
dmg = dmg*resist;
--add on bonuses (staff/day/weather/jas/mab/etc all go in this function)
dmg = addBonuses(caster,spell,target,dmg);
--add in target adjustment
dmg = adjustForTarget(target,dmg,spell:getElement());
--handling afflatus misery
dmg = handleAfflatusMisery(caster, spell, dmg);
--add in final adjustments
dmg = finalMagicAdjustments(caster,target,spell,dmg);
return dmg;
end
function calculateDurationForLvl(duration, spellLvl, targetLvl)
if (targetLvl < spellLvl) then
return duration * targetLvl / spellLvl;
end
return duration;
end
function calculateBarspellPower(caster,enhanceSkill)
local meritBonus = caster:getMerit(MERIT_BAR_SPELL_EFFECT);
--printf("Barspell: Merit Bonus +%d", meritBonus);
if (enhanceSkill == nil or enhanceSkill < 0) then
enhanceSkill = 0;
end
local power = 40 + 0.2 * enhanceSkill + meritBonus;
local equippedLegs = caster:getEquipID(SLOT_LEGS);
if (equippedLegs == 15119) then
power = power + 20;
elseif (equippedLegs == 15582) then
power = power + 22;
elseif (equippedLegs == 10712) then
power = power + 25;
end
return power;
end
| gpl-3.0 |
mercury233/ygopro-scripts | c93298460.lua | 6 | 1483 | --魔装戦士 ヴァンドラ
function c93298460.initial_effect(c)
--direct attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DIRECT_ATTACK)
c:RegisterEffect(e1)
--tohand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(93298460,0))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c93298460.condition)
e2:SetTarget(c93298460.target)
e2:SetOperation(c93298460.operation)
c:RegisterEffect(e2)
end
function c93298460.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c93298460.filter(c)
return c:IsType(TYPE_NORMAL) and c:IsRace(RACE_DRAGON+RACE_WARRIOR+RACE_SPELLCASTER) and c:IsAbleToHand()
end
function c93298460.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c93298460.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c93298460.filter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c93298460.filter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c93298460.operation(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 |
mercury233/ygopro-scripts | c52962804.lua | 2 | 1714 | --ドラグニティ・ドラフト
function c52962804.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,52962804+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c52962804.target)
c:RegisterEffect(e1)
--immune
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetTarget(c52962804.immtg)
e2:SetValue(c52962804.efilter)
c:RegisterEffect(e2)
end
function c52962804.thfilter(c)
return c:IsLevelBelow(4) and c:IsSetCard(0x29) and c:IsAbleToHand()
end
function c52962804.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c52962804.thfilter(chkc) end
if chk==0 then return true end
if Duel.IsExistingTarget(c52962804.thfilter,tp,LOCATION_GRAVE,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(52962804,0)) then
e:SetCategory(CATEGORY_TOHAND)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
e:SetOperation(c52962804.activate)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c52962804.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
else
e:SetCategory(0)
e:SetProperty(0)
e:SetOperation(nil)
end
end
function c52962804.activate(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
function c52962804.immtg(e,c)
return c:GetOriginalLevel()>=5 and c:IsSetCard(0x29) and Duel.GetAttacker()==c
end
function c52962804.efilter(e,te)
return te:GetOwnerPlayer()~=e:GetHandlerPlayer()
end
| gpl-2.0 |
guillaume144/jeu-rp | gamemode/modules/language/sh_interface.lua | 13 | 4169 | DarkRP.addLanguage = DarkRP.stub{
name = "addLanguage",
description = "Create a language/translation.",
parameters = {
{
name = "Language name",
description = "The short name of the language (\"en\" is English). Make sure the language name fits a possible value for gmod_language!",
type = "string",
optional = false
},
{
name = "Language contents",
description = "A table that contains the translation sentences. Look at sh_english.lua for an example.",
type = "table",
optional = false
}
},
returns = {
},
metatable = DarkRP
}
DarkRP.addPhrase = DarkRP.stub{
name = "addPhrase",
description = "Add a phrase to the existing translation.",
parameters = {
{
name = "Language name",
description = "The short name of the language (\"en\" is English). Make sure the language name fits a possible value for gmod_language!",
type = "string",
optional = false
},
{
name = "key",
description = "The name of the translated phrase.",
type = "string",
optional = false
},
{
name = "translation",
description = "The translation of the phrase.",
type = "string",
optional = false
}
},
returns = {
},
metatable = DarkRP
}
DarkRP.getPhrase = DarkRP.stub{
name = "getPhrase",
description = "Get a phrase from the selected language.",
parameters = {
{
name = "key",
description = "The name of the translated phrase.",
type = "string",
optional = false
},
{
name = "Phrase parameters",
description = "Some phrases need extra information, like in \"PLAYERNAME just won the lottery!\". Not filling in the phrase parameters will cause errors.",
type = "vararg",
optional = false
}
},
returns = {
{
name = "phrase",
description = "The formatted phrase.",
type = "string"
}
},
metatable = DarkRP
}
DarkRP.getMissingPhrases = DarkRP.stub{
name = "getMissingPhrases",
description = "Get all the phrases a language is missing.",
parameters = {
{
name = "languageCode",
description = "The language code of the language. For English this is \"en\".",
type = "string",
optional = true
}
},
returns = {
{
name = "missingPhrases",
description = "All the missing phrases formatted in such way that you can copy and paste it in your language file.",
type = "string"
}
},
metatable = DarkRP
}
DarkRP.addChatCommandsLanguage = DarkRP.stub{
name = "addChatCommandsLanguage",
description = "Add a translation table for chat command descriptions. See darkrpmod/lua/darkrp_language/chatcommands.lua for an example.",
parameters = {
{
name = "languageCode",
description = "The language code of the language. For English this is \"en\".",
type = "string",
optional = false
},
{
name = "translations",
description = "Key-value table with chat command strings as keys and their translation as value.",
type = "table",
optional = false
}
},
returns = {
},
metatable = DarkRP
}
DarkRP.getChatCommandDescription = DarkRP.stub{
name = "getChatCommandDescription",
description = "Get the translated description of a chat command.",
parameters = {
{
name = "command",
description = "The chat command string.",
type = "string",
optional = false
}
},
returns = {
{
name = "description",
description = "The translated chat command description.",
type = "string"
}
},
metatable = DarkRP
}
| mit |
Cavitt/vanilla-ot | data/npc/REFERENCETHESE/Thorgrinfarmine.lua | 1 | 2038 | local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'kazordoon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to go to Kazordoon to try the beer there? free?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 0, cost = 0, destination = {x=32659, y=31957, z=15} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})
local travelNode = keywordHandler:addKeyword({'cormaya'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to go to Cormaya for free?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 0, cost = 0, destination = {x=33310, y=31988, z=15} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Yes, I\'m the captain of this ship.'})
keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Yes, I\'m the captain of this ship.'})
npcHandler:addModule(FocusModule:new()) | agpl-3.0 |
Zenny89/darkstar | scripts/zones/Norg/npcs/Paito-Maito.lua | 34 | 2624 | -----------------------------------
-- Area: Norg
-- NPC: Paito-Maito
-- Standard Info NPC
-----------------------------------
require("scripts/globals/pathfind");
local path = {
-71.189713, -9.413510, 74.024879,
-71.674171, -9.317029, 73.054794,
-72.516525, -9.298064, 72.363213,
-73.432983, -9.220915, 71.773857,
-74.358955, -9.142115, 71.163277,
-75.199585, -9.069098, 70.583145,
-76.184708, -9.006280, 70.261375,
-77.093193, -9.000236, 70.852921,
-77.987053, -9.037421, 71.464264,
-79.008476, -9.123112, 71.825165,
-80.083740, -9.169785, 72.087944,
-79.577698, -9.295252, 73.087708,
-78.816307, -9.365192, 73.861855,
-77.949852, -9.323165, 74.500496,
-76.868950, -9.301287, 74.783707,
-75.754913, -9.294973, 74.927345,
-74.637566, -9.341335, 74.902016,
-73.521400, -9.382154, 74.747322,
-72.420792, -9.415255, 74.426178,
-71.401161, -9.413510, 74.035446,
-70.392426, -9.413510, 73.627884,
-69.237152, -9.413510, 73.155815,
-70.317207, -9.413510, 73.034027,
-71.371315, -9.279585, 72.798569,
-72.378838, -9.306310, 72.392982,
-73.315544, -9.230491, 71.843933,
-74.225883, -9.153550, 71.253113,
-75.120522, -9.076024, 70.638908,
-76.054642, -9.019394, 70.204910,
-76.981323, -8.999838, 70.762978,
-77.856903, -9.024825, 71.403915,
-78.876686, -9.115798, 71.789764,
-79.930756, -9.171277, 72.053635,
-79.572502, -9.295024, 73.087646,
-78.807686, -9.364762, 73.869614,
-77.916420, -9.321617, 74.516357,
-76.824738, -9.300390, 74.790466,
-75.738380, -9.295794, 74.930130,
-74.620911, -9.341956, 74.899994,
-73.493645, -9.382988, 74.739204,
-72.413185, -9.415321, 74.420128,
-71.452393, -9.413510, 74.054657,
-70.487755, -9.413510, 73.666130
};
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(0x005A);
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 |
fusijie/cocos2d-x-samples | samples/KillBug/src/app/views/BugSprite.lua | 10 | 1088 |
local BugSprite = class("BugSprite", function(imageFilename)
local texture = display.getImage(imageFilename)
local frameWidth = texture:getPixelsWide() / 3
local frameHeight = texture:getPixelsHigh()
local spriteFrame = display.newSpriteFrame(texture, cc.rect(0, 0, frameWidth, frameHeight))
local sprite = display.newSprite(spriteFrame)
sprite.animationName_ = imageFilename
sprite.frameWidth_ = frameWidth
sprite.frameHeight_ = frameHeight
return sprite
end)
function BugSprite:ctor(imageFilename, bugModel)
self.model_ = bugModel
end
function BugSprite:getModel()
return self.model_
end
function BugSprite:start(destination)
self.model_:setDestination(destination)
self:updatePosition()
self:playAnimationForever(display.getAnimationCache(self.animationName_))
return self
end
function BugSprite:step(dt)
self.model_:step(dt)
self:updatePosition()
return self
end
function BugSprite:updatePosition()
self:move(self.model_:getPosition())
:rotate(self.model_:getRotation())
end
return BugSprite
| mit |
mercury233/ygopro-scripts | c79229522.lua | 2 | 1501 | --キメラテック・フォートレス・ドラゴン
function c79229522.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCodeFunRep(c,70095154,c79229522.mfilter,1,63,true,true)
aux.AddContactFusionProcedure(c,c79229522.cfilter,LOCATION_ONFIELD,LOCATION_ONFIELD,c79229522.sprop(c))
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c79229522.splimit)
c:RegisterEffect(e1)
--cannot be fusion material
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e3:SetValue(1)
c:RegisterEffect(e3)
end
c79229522.material_setcode=0x1093
function c79229522.splimit(e,se,sp,st)
return e:GetHandler():GetLocation()~=LOCATION_EXTRA
end
function c79229522.mfilter(c)
return c:IsRace(RACE_MACHINE) and c:IsType(TYPE_MONSTER)
end
function c79229522.cfilter(c,fc)
return c:IsAbleToGraveAsCost() and (c:IsControler(fc:GetControler()) or c:IsFaceup())
end
function c79229522.sprop(c)
return function(g)
Duel.SendtoGrave(g,REASON_COST)
--spsummon condition
local ct=g:GetCount()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetReset(RESET_EVENT+0xff0000)
e1:SetValue(ct*1000)
c:RegisterEffect(e1)
end
end
| gpl-2.0 |
AntonioModer/fuccboiGDX | fuccboi/libraries/thranduil/Button.lua | 1 | 3611 | local Button = {}
Button.__index = Button
function Button.new(ui, x, y, w, h, settings)
local self = {}
self.ui = ui
self.id = self.ui.addToElementsList(self)
self.ix, self.iy = x, y
self.x, self.y = x, y
self.w, self.h = w, h
local settings = settings or {}
for k, v in pairs(settings) do self[k] = v end
self.input = self.ui.Input()
self.input:bind('return', 'key-enter')
self.input:bind('mouse1', 'left-click')
self.hot = false -- true if the mouse is over the object (inside its x, y, w, h rectangle)
self.selected = false -- true if currently selected with TAB (for instance) so it can be pressed with a key
self.down = false -- true if currently being pressed
self.pressed = false -- true on the frame it has been pressed
self.released = false -- true on the frame it has been released
self.enter = false -- true on the frame the mouse has entered the frame
self.exit = false -- true on the frame the mouse has exited the frame
self.pressing = false
self.previous_hot = false
self.previous_selected = false
return setmetatable(self, Button)
end
function Button:update(dt, parent)
local x, y = love.mouse.getPosition()
if parent then self.x, self.y = parent.x + self.ix, parent.y + self.iy end
-- Check for hot
if x >= self.x and x <= self.x + self.w and y >= self.y and y <= self.y + self.h then
self.hot = true
else self.hot = false end
-- Check for enter
if self.hot and not self.previous_hot then
self.enter = true
else self.enter = false end
-- Check for exit
if not self.hot and self.previous_hot then
self.exit = true
else self.exit = false end
-- Check for selected_enter
if self.selected and not self.previous_selected then
self.selected_enter = true
else self.selected_enter = false end
-- Check for selected_exit
if not self.selected and self.previous_selected then
self.selected_exit = true
else self.selected_exit = false end
-- Check for pressed/released/down on mouse hover
if self.hot and self.input:pressed('left-click') then
self.pressed = true
self.pressing = true
end
if self.pressing and self.input:down('left-click') then
self.down = true
end
if self.pressing and self.input:released('left-click') then
self.released = true
self.pressing = false
self.down = false
end
-- Check for pressed/released/down on key press
if self.selected and self.input:pressed('key-enter') then
self.pressed = true
self.pressing = true
end
if self.pressing and self.input:down('key-enter') then
self.down = true
end
if self.pressing and self.input:released('key-enter') then
self.released = true
self.pressing = false
self.down = false
end
if self.pressed and self.previous_pressed then self.pressed = false end
if self.released and self.previous_released then self.released = false end
-- Set previous frame state
self.previous_hot = self.hot
self.previous_pressed = self.pressed
self.previous_released = self.released
self.previous_selected = self.selected
self.input:update(dt)
end
function Button:draw()
if self.theme then self.theme.Button.draw(self) end
end
function Button:bind(key, action)
self.input:bind(key, action)
end
function Button:destroy()
self.ui.removeFromElementsList(self.id)
end
return setmetatable({new = new}, {__call = function(_, ...) return Button.new(...) end})
| mit |
Zenny89/darkstar | scripts/zones/Windurst_Waters_[S]/npcs/Kocco_Ehllek.lua | 38 | 1053 | -----------------------------------
-- Area: Windurst Waters (S)
-- NPC: Kocco Ehllek
-- Type: Quest Giver
-- @zone: 94
-- @pos -41.465 -2.125 -163.018
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil;
-----------------------------------
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x008c);
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 |
mercury233/ygopro-scripts | c54407825.lua | 2 | 1740 | --驚天動地
function c54407825.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--to deck
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c54407825.condition)
e2:SetTarget(c54407825.target)
e2:SetOperation(c54407825.operation)
c:RegisterEffect(e2)
end
function c54407825.filter(c)
return c:IsPreviousLocation(LOCATION_DECK)
end
function c54407825.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c54407825.filter,1,nil)
end
function c54407825.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToDeck() end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
end
function c54407825.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_TO_GRAVE)
e1:SetTargetRange(LOCATION_DECK,LOCATION_DECK)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_CANNOT_DISCARD_DECK)
e2:SetTargetRange(1,1)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Sauromugue_Champaign_[S]/Zone.lua | 16 | 1606 | -----------------------------------
--
-- Zone: Sauromugue_Champaign_[S] (98)
--
-----------------------------------
package.loaded["scripts/zones/Sauromugue_Champaign_[S]/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Sauromugue_Champaign_[S]/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(-104,-25.36,-410,195);
end
if (prevZone == 91 and player:getQuestStatus(CRYSTAL_WAR, DOWNWARD_HELIX) == QUEST_ACCEPTED and player:getVar("DownwardHelix") == 2) then
cs = 0x0003;
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
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 == 0x0003) then
player:setVar("DownwardHelix",3);
end
end; | gpl-3.0 |
mercury233/ygopro-scripts | c91135480.lua | 2 | 4109 | --クロノダイバー・ダブルバレル
function c91135480.initial_effect(c)
c:EnableReviveLimit()
aux.AddXyzProcedure(c,nil,4,2)
--Apply
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(91135480,0))
e1:SetCategory(CATEGORY_DISABLE+CATEGORY_ATKCHANGE+CATEGORY_CONTROL)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,91135480)
e1:SetCondition(c91135480.condition)
e1:SetTarget(c91135480.target)
e1:SetOperation(c91135480.operation)
c:RegisterEffect(e1)
end
function c91135480.condition(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp
end
function c91135480.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local c=e:GetHandler()
if not c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT) then return false end
local g=c:GetOverlayGroup()
if g:IsExists(Card.IsType,1,nil,TYPE_MONSTER)
then return true end
if g:IsExists(Card.IsType,1,nil,TYPE_SPELL)
and Duel.IsExistingMatchingCard(c91135480.ctfilter,tp,0,LOCATION_MZONE,1,nil) then return true end
if g:IsExists(Card.IsType,1,nil,TYPE_TRAP)
and Duel.IsExistingMatchingCard(aux.NegateEffectMonsterFilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) then return true end
return false
end
end
function c91135480.check(g)
return g:FilterCount(Card.IsType,nil,TYPE_MONSTER)<=1
and g:FilterCount(Card.IsType,nil,TYPE_SPELL)<=1
and g:FilterCount(Card.IsType,nil,TYPE_TRAP)<=1
end
function c91135480.ctfilter(c)
return c:IsFaceup() and c:IsControlerCanBeChanged()
end
function c91135480.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or not c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT) then return end
local g=c:GetOverlayGroup()
local tg=Group.CreateGroup()
if c:IsFaceup() then
tg:Merge(g:Filter(Card.IsType,nil,TYPE_MONSTER))
end
if Duel.IsExistingMatchingCard(c91135480.ctfilter,tp,0,LOCATION_MZONE,1,nil) then
tg:Merge(g:Filter(Card.IsType,nil,TYPE_SPELL))
end
if Duel.IsExistingMatchingCard(c91135480.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) then
tg:Merge(g:Filter(Card.IsType,nil,TYPE_TRAP))
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVEXYZ)
local sg=tg:SelectSubGroup(tp,c91135480.check,false,1,3)
if not sg then return end
Duel.SendtoGrave(sg,REASON_EFFECT)
Duel.RaiseSingleEvent(c,EVENT_DETACH_MATERIAL,e,0,0,0,0)
if sg:IsExists(Card.IsType,1,nil,TYPE_MONSTER) then
Duel.BreakEffect()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
e1:SetValue(400)
c:RegisterEffect(e1)
end
if sg:IsExists(Card.IsType,1,nil,TYPE_SPELL) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
local g=Duel.SelectMatchingCard(tp,c91135480.ctfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.HintSelection(g)
local tc=g:GetFirst()
if Duel.GetControl(tc,tp,PHASE_END,1)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_TRIGGER)
tc:RegisterEffect(e2)
end
end
if sg:IsExists(Card.IsType,1,nil,TYPE_TRAP) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLE)
local g=Duel.SelectMatchingCard(tp,aux.NegateEffectMonsterFilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
if g:GetCount()>0 then
local tc=g:GetFirst()
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_DISABLE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetCode(EFFECT_DISABLE_EFFECT)
e4:SetValue(RESET_TURN_SET)
e4:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e4)
end
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c38891741.lua | 2 | 1458 | --神の摂理
function c38891741.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c38891741.condition)
e1:SetCost(c38891741.cost)
e1:SetTarget(c38891741.target)
e1:SetOperation(c38891741.activate)
c:RegisterEffect(e1)
end
function c38891741.condition(e,tp,eg,ep,ev,re,r,rp)
return (re:IsActiveType(TYPE_MONSTER) or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and Duel.IsChainNegatable(ev)
end
function c38891741.cfilter(c,type)
return c:IsType(type) and c:IsDiscardable()
end
function c38891741.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if Duel.IsPlayerAffectedByEffect(tp,EFFECT_DISCARD_COST_CHANGE) then return true end
local type=bit.band(re:GetActiveType(),0x7)
if chk==0 then return Duel.IsExistingMatchingCard(c38891741.cfilter,tp,LOCATION_HAND,0,1,nil,type) end
Duel.DiscardHand(tp,c38891741.cfilter,1,1,REASON_COST+REASON_DISCARD,nil,type)
end
function c38891741.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c38891741.activate(e,tp,eg,ep,ev,re,r,rp)
if not Duel.NegateActivation(ev) then return end
if re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c25847467.lua | 2 | 1081 | --暗黒界の刺客 カーキ
function c25847467.initial_effect(c)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(25847467,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c25847467.descon)
e1:SetTarget(c25847467.destg)
e1:SetOperation(c25847467.desop)
c:RegisterEffect(e1)
end
function c25847467.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_HAND) and bit.band(r,0x4040)==0x4040
end
function c25847467.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c25847467.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Upper_Jeuno/npcs/Appollonia.lua | 59 | 1039 | -----------------------------------
-- Area: Upper Jeuno
-- NPC: Appollonia
-- Type: Weather Reporter
-----------------------------------
package.loaded["scripts/zones/Upper_Jeuno/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Upper_Jeuno/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
player:startEvent(0x82718,0,0,0,0,0,0,0,VanadielTime());
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 |
ytodorov/AntServices | AdvancedNetToolsSolution/AntServicesMvc5/programs/Nmap/nselib/xmpp.lua | 3 | 16150 | --- A XMPP (Jabber) library, implementing a minimal subset of the protocol
-- enough to do authentication brute-force.
--
-- The XML parsing of tags isn't optimal but there's no other easy way
-- (nulls or line-feeds) to match the end of a message. The parse_tag
-- method in the XML class was borrowed from the initial xmpp.nse
-- script written by Vasiliy Kulikov.
--
-- The library consist of the following classes:
-- * <code>XML</code> - containing a minimal XML parser written by
-- Vasiliy Kulikov.
-- * <code>TagProcessor</code> - Contains processing code for common tags
-- * <code>XMPP</code> - containing the low-level functions used to
-- communicate with the Jabber server.
-- * <code>Helper</code> - containing the main interface for script
-- writers
--
-- The following sample illustrates how to use the library to authenticate
-- to a XMPP sever:
-- <code>
-- local helper = xmpp.Helper:new(host, port, options)
-- local status, err = helper:connect()
-- status, err = helper:login(user, pass, "DIGEST-MD5")
-- </code>
--
-- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html
-- @author Patrik Karlsson <patrik@cqure.net>
-- Version 0.2
-- Created 07/19/2011 - v0.1 - Created by Patrik Karlsson
-- Revised 07/22/2011 - v0.2 - Added TagProcessors and two new auth mechs:
-- CRAM-MD5 and LOGIN <patrik@cqure.net>
local base64 = require "base64"
local nmap = require "nmap"
local sasl = require "sasl"
local stdnse = require "stdnse"
local string = require "string"
local table = require "table"
_ENV = stdnse.module("xmpp", stdnse.seeall)
-- This is a trivial XML processor written by Vasiliy Kulikov. It doesn't
-- fully support XML, but it should be sufficient for the basic XMPP
-- stream handshake. If you see stanzas with uncommon symbols, feel
-- free to enhance these regexps.
XML = {
---XML tag table
--@class table
--@name XML.tag
--@field name The tag name
--@field attrs The tag attributes as a key-value table
--@field start True if this was an opening tag.
--@field contents The contents of the tag
--@field finish true if the tag was closed.
---Parse an XML tag
--@name XML.parse_tag
--@param s String containing the XML tag
--@return XML tag table
--@see XML.tag
parse_tag = function(s)
local _, _, contents, empty, name = string.find(s, "([^<]*)<(/?)([?:%w-]+)")
local attrs = {}
if not name then
return
end
for k, v in string.gmatch(s, "%s([%w:]+)='([^']+)'") do
attrs[k] = v
end
for k, v in string.gmatch(s, "%s([%w:]+)=\"([^\"]+)\"") do
attrs[k] = v
end
local finish = (empty ~= "") or (s:sub(#s-1) == '/>')
return { name = name,
attrs = attrs,
start = (empty == ""),
contents = contents,
finish = finish }
end,
}
TagProcessor = {
["failure"] = function(socket, tag)
return TagProcessor["success"](socket,tag)
end,
["success"] = function(socket, tag)
if ( tag.finish ) then return true end
local newtag
repeat
local status, data = socket:receive_buf(">", true)
if ( not(status) ) then
return false, ("ERROR: Failed to process %s tag"):format(tag.name)
end
newtag = XML.parse_tag(data)
until( newtag.finish and newtag.name == tag.name )
if ( newtag.name == tag.name ) then return true, tag end
return false, ("ERROR: Failed to process %s tag"):format(tag.name)
end,
["challenge"] = function(socket, tag)
local status, data = socket:receive_buf(">", true)
if ( not(status) ) then return false, "ERROR: Failed to read challenge tag" end
local tag = XML.parse_tag(data)
if ( not(status) or tag.name ~= "challenge" ) then
return false, "ERROR: Failed to process challenge"
end
return status, (tag.contents and base64.dec(tag.contents))
end,
}
XMPP = {
--- Creates a new instance of the XMPP class
--
-- @name XMPP.new
-- @param host table as received by the action function
-- @param port table as received by the action function
-- @param options table containing options, currently supported
-- * <code>timeout</code> - sets the socket timeout
-- * <code>servername</code> - sets the server name to use in
-- communication with the server.
-- * <code>starttls</code> - start TLS handshake even if it is optional.
new = function(self, host, port, options)
local o = { host = host,
port = port,
options = options or {},
auth = { mechs = {} } }
o.options.timeout = o.options.timeout and o.options.timeout or 10
o.servername = stdnse.get_hostname(host) or o.options.servername
setmetatable(o, self)
self.__index = self
return o
end,
--- Sends data to XMPP server
-- @name XMPP.send
-- @param data string containing data to send to server
-- @return status true on success false on failure
-- @return err string containing error message
send = function(self, data)
-- this ain't pretty, but we try to "flush" what's left of the receive
-- buffer, prior to send. This way we account for not reading to the
-- end of one message resulting in the next read reading from our
-- previous message.
self.socket:set_timeout(1)
repeat
local status = self.socket:receive_buf("\0", false)
until(not(status))
self.socket:set_timeout(self.options.timeout * 1000)
return self.socket:send(data)
end,
--- Receives a XML tag from the server
--
-- @name XMPP.receive_tag
-- @param tag [optional] if unset, receives the next available tag
-- if set, reads until the given tag has been found
-- @param close [optional] if set, matches a closing tag
-- @return true on success, false on error
-- @return The XML tag table, or error message
-- @see XML.tag
receive_tag = function(self, tag, close)
local result
repeat
local status, data = self.socket:receive_buf(">", true)
if ( not(status) ) then return false, data end
result = XML.parse_tag(data)
until( ( not(tag) and (close == nil or result.finish == close ) ) or
( tag == result.name and ( close == nil or result.finish == close ) ) )
return true, result
end,
--- Connects to the XMPP server
-- @name XMPP.connect
-- @return status true on success, false on failure
-- @return err string containing an error message if status is false
connect = function(self)
assert(self.servername,
"Cannot connect to XMPP server without valid server name")
-- we may be reconnecting using SSL
if ( not(self.socket) ) then
self.socket = nmap.new_socket()
self.socket:set_timeout(self.options.timeout * 1000)
local status, err = self.socket:connect(self.host, self.port)
if ( not(status) ) then
return false, err
end
end
local data = ("<?xml version='1.0' ?><stream:stream to='%s' xmlns='jabber:client'" ..
" xmlns:stream='http://etherx.jabber.org/streams'" ..
" version='1.0'>"):format(self.servername)
local status, err = self:send(data)
if ( not(status) ) then return false, "ERROR: Failed to connect to server" end
local version, start_tls
repeat
local status, tag = self:receive_tag()
if ( not(status) ) then return false, "ERROR: Failed to connect to server" end
if ( tag.name == "stream:stream" ) then
version = tag.attrs and tag.attrs.version
elseif ( tag.name == "starttls" and tag.start ) then
status, tag = self:receive_tag()
if ( not(status) ) then
return false, "ERROR: Failed to connect to server"
end
if ( tag.name ~= "starttls" ) then
start_tls = tag.name
else
start_tls = "optional"
end
elseif ( tag.name == "mechanism" and tag.finish ) then
self.auth.mechs[tag.contents] = true
end
until(tag.name == "stream:features" and tag.finish)
if ( version ~= "1.0" ) then
return false, "ERROR: Only version 1.0 is supported"
end
if ( start_tls == "required" or self.options.starttls) then
status, err = self:send("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>")
if ( not(status) ) then return false, "ERROR: Failed to initiate STARTTLS" end
local status, tag = self:receive_tag()
if ( not(status) ) then return false, "ERROR: Failed to receive from server" end
if ( tag.name == "proceed" ) then
status, err = self.socket:reconnect_ssl()
self.options.starttls = false
return self:connect()
end
end
return true
end,
--- Logs in to the XMPP server
--
-- @name XMPP.login
-- @param username string
-- @param password string
-- @param mech string containing a supported authentication mechanism
-- @return status true on success, false on failure
-- @return err string containing error message if status is false
login = function(self, username, password, mech)
assert(mech == "PLAIN" or
mech == "DIGEST-MD5" or
mech == "CRAM-MD5" or
mech == "LOGIN",
"Unsupported authentication mechanism")
local auth = ("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' " ..
"mechanism='%s'/>"):format(mech)
-- we currently don't do anything with the realm
local realm
-- we need to cut the @domain.tld from the username
if ( username:match("@") ) then
username, realm = username:match("^(.*)@(.*)$")
end
local status, result
if ( mech == "PLAIN" ) then
local mech_params = { username, password }
local auth_data = sasl.Helper:new(mech):encode(table.unpack(mech_params))
auth = ("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' " ..
"mechanism='%s'>%s</auth>"):format(mech, base64.enc(auth_data))
status, result = self.socket:send(auth)
if ( not(status) ) then return false, "ERROR: Failed to send SASL PLAIN authentication" end
status, result = self:receive_tag()
if ( not(status) ) then return false, "ERROR: Failed to receive login response" end
if ( result.name == "failure" ) then
status = TagProcessor[result.name](self.socket, result)
end
else
local status, err = self.socket:send(auth)
if(not(status)) then return false, "ERROR: Failed to initiate SASL login" end
local chall
status, result = self:receive_tag()
if ( not(status) ) then return false, "ERROR: Failed to retrieve challenge" end
status, chall = TagProcessor[result.name](self.socket, result)
if ( mech == "LOGIN" ) then
if ( chall ~= "User Name" ) then
return false, ("ERROR: Login expected 'User Name' received: %s"):format(chall)
end
self.socket:send("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>" ..
base64.enc(username) ..
"</response>")
status, result = self:receive_tag()
if ( not(status) or result.name ~= "challenge") then
return false, "ERROR: Receiving tag from server"
end
status, chall = TagProcessor[result.name](self.socket, result)
if ( chall ~= "Password" ) then
return false, ("ERROR: Login expected 'Password' received: %s"):format(chall)
end
self.socket:send("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>" ..
base64.enc(password) ..
"</response>")
status, result = self:receive_tag()
if ( not(status) ) then return false, "ERROR: Failed to receive login challenge" end
if ( result.name == "failure" ) then
status = TagProcessor[result.name](self.socket, result)
return false, "Login failed"
end
else
local mech_params = { username, password, chall, "xmpp", "xmpp/" .. self.servername }
local auth_data = sasl.Helper:new(mech):encode(table.unpack(mech_params))
auth_data = "<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>" ..
base64.enc(auth_data) .. "</response>"
status, err = self.socket:send(auth_data)
-- read to the end tag regardless of what it is
-- it should be one of either: success, challenge or error
repeat
status, result = self:receive_tag()
if ( not(status) ) then return false, "ERROR: Failed to receive login challenge" end
if ( result.name == "failure" ) then
status = TagProcessor[result.name](self.socket, result)
return false, "Login failed"
elseif ( result.name == "success" ) then
status = TagProcessor[result.name](self.socket, result)
if ( not(status) ) then return false, "Failed to process success message" end
return true, "Login success"
elseif ( result.name ~= "challenge" ) then
return false, "ERROR: Failed to receive login challenge"
end
until( result.name == "challenge" and result.finish )
if ( result.name == "challenge" and mech == "DIGEST-MD5" ) then
status, result = self.socket:send("<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>")
if ( not(status) ) then return false, "ERROR: Failed to send DIGEST-MD5 request" end
status, result = self:receive_tag()
if ( not(status) ) then return false, "ERROR: Failed to receive DIGEST-MD5 response" end
end
end
end
if ( result.name == "success" ) then
return true, "Login success"
end
return false, "Login failed"
end,
--- Retrieves the available authentication mechanisms
-- @name XMPP.getAuthMechs
-- @return table containing all available authentication mechanisms
getAuthMechs = function(self) return self.auth.mechs end,
--- Disconnects the socket from the server
-- @name XMPP.disconnect
-- @return status true on success, false on failure
-- @return error message if status is false
disconnect = function(self)
local status, err = self.socket:close()
self.socket = nil
return status, err
end,
}
Helper = {
--- Creates a new Helper instance
-- @name Helper.new
-- @param host table as received by the action function
-- @param port table as received by the action function
-- @param options table containing options, currently supported
-- * <code>timeout</code> - sets the socket timeout
-- * <code>servername</code> - sets the server name to use in
-- communication with the server.
new = function(self, host, port, options)
local o = { host = host,
port = port,
options = options or {},
xmpp = XMPP:new(host, port, options),
state = "" }
setmetatable(o, self)
self.__index = self
return o
end,
--- Connects to the XMPP server and starts the initial communication
-- @name Helper.connect
-- @return status true on success, false on failure
-- @return err string containing an error message is status is false
connect = function(self)
if ( not(self.host.targetname) and
not(self.options.servername) ) then
return false, "ERROR: Cannot connect to XMPP server without valid server name"
end
self.state = "CONNECTED"
return self.xmpp:connect()
end,
--- Login to the XMPP server
--
-- @name Helper.login
-- @param username string
-- @param password string
-- @param mech string containing a supported authentication mechanism
-- @see Helper.getAuthMechs
-- @return status true on success, false on failure
-- @return err string containing error message if status is false
login = function(self, username, password, mech)
return self.xmpp:login(username, password, mech)
end,
--- Retrieves the available authentication mechanisms
-- @name Helper.getAuthMechs
-- @return table containing all available authentication mechanisms
getAuthMechs = function(self)
if ( self.state == "CONNECTED" ) then
return self.xmpp:getAuthMechs()
end
return
end,
--- Closes the connection to the server
-- @name Helper.close
close = function(self)
self.xmpp:disconnect()
self.state = "DISCONNECTED"
end,
}
return _ENV;
| apache-2.0 |
mercury233/ygopro-scripts | c61068510.lua | 6 | 1269 | --トルネード
function c61068510.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c61068510.condition)
e1:SetTarget(c61068510.target)
e1:SetOperation(c61068510.activate)
c:RegisterEffect(e1)
end
function c61068510.cfilter(c)
return c:GetSequence()<5
end
function c61068510.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c61068510.cfilter,tp,0,LOCATION_SZONE,3,nil)
end
function c61068510.filter(c)
return c:GetSequence()<5
end
function c61068510.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsControler(1-tp) and c61068510.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c61068510.filter,tp,0,LOCATION_SZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c61068510.filter,tp,0,LOCATION_SZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c61068510.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c8396952.lua | 4 | 1904 | --アルカナフォースⅠ-THE MAGICIAN
function c8396952.initial_effect(c)
--coin
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(8396952,0))
e1:SetCategory(CATEGORY_COIN)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c8396952.cointg)
e1:SetOperation(c8396952.coinop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e3)
end
c8396952.toss_coin=true
function c8396952.cointg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1)
end
function c8396952.coinop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local res=0
if c:IsHasEffect(73206827) then
res=1-Duel.SelectOption(tp,60,61)
else res=Duel.TossCoin(tp,1) end
c8396952.arcanareg(c,res)
end
function c8396952.arcanareg(c,coin)
--disable effect
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetRange(LOCATION_MZONE)
e1:SetOperation(c8396952.speop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
c:RegisterFlagEffect(36690018,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,coin,63-coin)
end
function c8396952.speop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not re:IsActiveType(TYPE_SPELL) or not re:IsHasType(EFFECT_TYPE_ACTIVATE) then return end
local val=c:GetFlagEffectLabel(36690018)
if val==1 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(c:GetBaseAttack()*2)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
else
Duel.Recover(1-tp,500,REASON_EFFECT)
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Northern_San_dOria/npcs/Helaku.lua | 22 | 2994 | -----------------------------------
-- Area: Northern San d'Oria
-- NPC: Helaku
-- Involved in Missions 2-3
-- @zone 231
-- @pos 49 -2 -12
-----------------------------------
package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/globals/missions");
require("scripts/zones/Northern_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local currentMission = player:getCurrentMission(BASTOK);
local missionStatus = player:getVar("MissionStatus");
if (currentMission == THE_EMISSARY) then
-- Bastok Mission 2-3 Part I - San d'Oria > Windurst
if (missionStatus == 1) then
player:startEvent(0x02a4);
elseif (missionStatus == 2) then
player:startEvent(0x0218);
elseif (missionStatus == 3) then
player:showText(npc,HELAKU_DIALOG);
-- Bastok Mission 2-3 Part II - Windurst > San d'Oria
elseif (missionStatus == 7) then
player:startEvent(0x0219);
elseif (missionStatus == 11) then
player:startEvent(0x022d);
end
-- Bastok Mission 2-3 Part I - San d'Oria > Windurst
elseif (currentMission == THE_EMISSARY_SANDORIA) then
if (missionStatus <= 4) then
player:startEvent(0x021e);
else
player:startEvent(0x021f);
end
-- Bastok Mission 2-3 Part II - Windurst > San d'Oria
elseif (currentMission == THE_EMISSARY_SANDORIA2) then
missionStatus = player:getVar("MissionStatus");
if (missionStatus == 8) then
player:startEvent(0x0219);
elseif (missionStatus == 9) then
player:startEvent(0x021e);
elseif (player:hasKeyItem(KINDRED_CREST)) then
player:startEvent(0x0221);
end
else
player:startEvent(0x021d);
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 == 0x0218) then
player:setVar("MissionStatus",3);
elseif (csid == 0x021f) then
player:addMission(BASTOK,THE_EMISSARY);
player:setVar("MissionStatus",6);
elseif (csid == 0x0219 and option == 0) then
player:addMission(BASTOK,THE_EMISSARY_SANDORIA2);
player:setVar("MissionStatus",8);
elseif (csid == 0x0221) then
player:addMission(BASTOK,THE_EMISSARY);
player:setVar("MissionStatus",11);
player:addKeyItem(KINDRED_REPORT);
player:messageSpecial(KEYITEM_OBTAINED,KINDRED_REPORT);
player:delKeyItem(KINDRED_CREST);
end
end; | gpl-3.0 |
Zenny89/darkstar | scripts/zones/Mog_Garden/Zone.lua | 28 | 1310 | -----------------------------------
--
-- Zone: Mog Garden (280)
--
-----------------------------------
package.loaded["scripts/zones/Mog_Garden/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/zones/Mog_Garden/TextIDs");
-----------------------------------
-- onInitialize
-----------------------------------
function onInitialize(zone)
end;
-----------------------------------
-- onZoneIn
-----------------------------------
function onZoneIn(player,prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(-2.517, 0.452, -5.068,190);
end
return cs;
end;
-----------------------------------
-- onRegionEnter
-----------------------------------
function onRegionEnter(player,region)
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 |
mercury233/ygopro-scripts | c54484652.lua | 2 | 2422 | --超戦士カオス・ソルジャー
function c54484652.initial_effect(c)
c:SetSPSummonOnce(54484652)
c:EnableReviveLimit()
--damage
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(aux.bdogcon)
e1:SetTarget(c54484652.damtg)
e1:SetOperation(c54484652.damop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c54484652.spcon)
e2:SetTarget(c54484652.sptg)
e2:SetOperation(c54484652.spop)
c:RegisterEffect(e2)
end
function c54484652.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local bc=e:GetHandler():GetBattleTarget()
Duel.SetTargetCard(bc)
local dam=bc:GetBaseAttack()
if dam<0 then dam=0 end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(dam)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam)
end
function c54484652.damop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local dam=tc:GetBaseAttack()
if dam<0 then dam=0 end
Duel.Damage(p,dam,REASON_EFFECT)
end
end
function c54484652.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_BATTLE)
or (rp==1-tp and c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp))
end
function c54484652.spfilter(c,e,tp)
return c:IsSetCard(0xbd) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c54484652.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c54484652.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
function c54484652.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(c54484652.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c54514594.lua | 4 | 1281 | --ヴォルカニック・ハンマー
function c54514594.initial_effect(c)
--damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(54514594,0))
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c54514594.cost)
e1:SetTarget(c54514594.target)
e1:SetOperation(c54514594.operation)
c:RegisterEffect(e1)
end
function c54514594.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetAttackAnnouncedCount()==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
function c54514594.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_GRAVE,0,1,nil,0x32) end
Duel.SetTargetPlayer(1-tp)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0)
end
function c54514594.operation(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local d=Duel.GetMatchingGroupCount(Card.IsSetCard,tp,LOCATION_GRAVE,0,nil,0x32)*200
Duel.Damage(p,d,REASON_EFFECT)
end
| gpl-2.0 |
Distrotech/highlight | plugins/java_library.lua | 4 | 59696 | --[[
Sample plugin file for highlight 3.1
USAGE: highlight -I main.java --plug-in=plugin.lua
]]
Description="Add standard library class names to Java definition"
-- optional parameter: syntax description
function syntaxUpdate(desc)
if desc=="Java" then
table.insert( Keywords,
{ Id=2, List={
"AWTError", "AWTEvent", "AWTEventListener", "AWTEventListenerProxy",
"AWTEventMulticaster", "AWTException", "AWTKeyStroke", "AWTPermission",
"AbstractAction", "AbstractBorderAbstractButton", "AbstractCellEditor",
"AbstractCollection", "AbstractColorChooserPanel", "AbstractDocument",
"AbstractInterruptibleChannelAbstractLayoutCacheAbstractList",
"AbstractListModel", "AbstractMap", "AbstractMethodError",
"AbstractPreferences", "AbstractQueue", "AbstractSchemaImpl",
"AbstractSelectableChannel", "AbstractSelectionKey", "AbstractSelector",
"AbstractSequentialList", "AbstractSet", "AbstractSpinnerModel",
"AbstractTableModel", "AbstractUndoableEdit", "AbstractVersion",
"AbstractWriter", "AccessControlContext", "AccessControlException",
"AccessController", "AccessException", "Accessible", "AccessibleAction",
"AccessibleAttributeSequence", "AccessibleBundle", "AccessibleComponent",
"AccessibleContext", "AccessibleEditableText", "AccessibleExtendedComponent",
"AccessibleExtendedTable", "AccessibleExtendedText", "AccessibleHyperlink",
"AccessibleHypertext", "AccessibleIcon", "AccessibleKeyBinding",
"AccessibleObject", "AccessibleRelation", "AccessibleRelationSet",
"AccessibleResourceBundle", "AccessibleRole", "AccessibleSelection",
"AccessibleState", "AccessibleStateSet", "AccessibleStreamable",
"AccessibleTable", "AccessibleTableModelChange", "AccessibleText",
"AccessibleTextSequence", "AccessibleValue", "AccountException",
"AccountExpiredException", "AccountLockedException", "AccountNotFoundException",
"Acl", "AclEntry", "AclNotFoundException", "Action", "ActionEvent",
"ActionListener", "ActionMap", "ActionMapUIResource", "Activatable",
"ActivateFailedException", "ActivationDesc", "ActivationException",
"ActivationGroup", "ActivationGroupDesc", "ActivationGroupID",
"ActivationGroup_Stub", "ActivationID", "ActivationInstantiator",
"ActivationMonitor", "ActivationSystem", "Activator", "ActiveEvent",
"AdapterActivator", "AdapterActivatorOperations", "AdapterAlreadyExists",
"AdapterAlreadyExistsHelper", "AdapterInactive", "AdapterInactiveHelper",
"AdapterManagerIdHelper", "AdapterNameHelper", "AdapterNonExistent",
"AdapterNonExistentHelper", "AdapterStateHelper", "AddressHelper", "Adjustable",
"AdjustmentEvent", "AdjustmentListener", "Adler32", "AffineTransform",
"AffineTransformOp", "AlgorithmParameterGenerator",
"AlgorithmParameterGeneratorSpi", "AlgorithmParameterSpec",
"AlgorithmParameters", "AlgorithmParametersSpi", "AllPermission",
"AlphaComposite", "AlreadyBound", "AlreadyBoundException", "AlreadyBoundHelper",
"AlreadyBoundHolder", "AlreadyConnectedException", "AncestorEvent",
"AncestorListener", "AnnotatedElement", "Annotation", "Annotation",
"AnnotationTypeMismatchError", "Any", "AnyHolder", "AnySeqHelper",
"AnySeqHelper", "AnySeqHolder", "AppConfigurationEntry", "Appendable", "Applet",
"AppletContext", "AppletInitializer", "AppletStub", "ApplicationException",
"Arc2D", "Area", "AreaAveragingScaleFilter", "ArithmeticException", "Array",
"Array", "ArrayBlockingQueue", "ArrayIndexOutOfBoundsException", "ArrayList",
"ArrayStoreException", "ArrayType", "Arrays", "AssertionError", "AsyncBoxView",
"AsynchronousCloseException", "AtomicBoolean", "AtomicInteger",
"AtomicIntegerArray", "AtomicIntegerFieldUpdater", "AtomicLong",
"AtomicLongArray", "AtomicLongFieldUpdater", "AtomicMarkableReference",
"AtomicReference", "AtomicReferenceArray", "AtomicReferenceFieldUpdater",
"AtomicStampedReference", "Attr", "Attribute", "Attribute", "Attribute",
"AttributeChangeNotification", "AttributeChangeNotificationFilter",
"AttributeException", "AttributeInUseException", "AttributeList",
"AttributeList", "AttributeList", "AttributeListImpl",
"AttributeModificationException", "AttributeNotFoundException", "AttributeSet",
"AttributeSet", "AttributeSet.ColorAttribute", "AttributeSet.FontAttribute",
"AttributeSet.ParagraphAttribute", "AttributeSetUtilities", "AttributeValueExp",
"AttributedCharacterIterator", "AttributedString", "Attributes", "Attributes",
"Attributes", "AttributesImpl", "AudioClip", "AudioFileFormat",
"AudioFileReader", "AudioFileWriter", "AudioFormat", "AudioInputStream",
"AudioPermission", "AudioSystem", "AuthPermission", "AuthProvider",
"AuthenticationException", "AuthenticationException",
"AuthenticationNotSupportedException", "Authenticator", "AuthorizeCallback",
"Autoscroll", "BAD_CONTEXT", "BAD_INV_ORDER", "BAD_OPERATION", "BAD_PARAM",
"BAD_POLICY", "BAD_POLICY_TYPE", "BAD_POLICY_VALUE", "BAD_TYPECODE",
"BMPImageWriteParam", "BackingStoreException", "BadAttributeValueExpException",
"BadBinaryOpValueExpException", "BadKind", "BadLocationException",
"BadPaddingException", "BadStringOperationException", "BandCombineOp",
"BandedSampleModel", "BaseRowSet", "BasicArrowButton", "BasicAttribute",
"BasicAttributes", "BasicBorders", "BasicButtonListener", "BasicButtonUI",
"BasicCheckBoxMenuItemUI", "BasicCheckBoxUI", "BasicColorChooserUI",
"BasicComboBoxEditor", "BasicComboBoxRenderer", "BasicComboBoxUI",
"BasicComboPopup", "BasicControl", "BasicDesktopIconUI", "BasicDesktopPaneUI",
"BasicDirectoryModel", "BasicEditorPaneUI", "BasicFileChooserUI",
"BasicFormattedTextFieldUI", "BasicGraphicsUtils", "BasicHTML",
"BasicIconFactory", "BasicInternalFrameTitlePane", "BasicInternalFrameUI",
"BasicLabelUI", "BasicListUI", "BasicLookAndFeel", "BasicMenuBarUI",
"BasicMenuItemUI", "BasicMenuUI", "BasicOptionPaneUI", "BasicPanelUI",
"BasicPasswordFieldUI", "BasicPermission", "BasicPopupMenuSeparatorUI",
"BasicPopupMenuUI", "BasicProgressBarUI", "BasicRadioButtonMenuItemUI",
"BasicRadioButtonUI", "BasicRootPaneUI", "BasicScrollBarUI",
"BasicScrollPaneUI", "BasicSeparatorUI", "BasicSliderUI", "BasicSpinnerUI",
"BasicSplitPaneDivider", "BasicSplitPaneUI", "BasicStroke", "BasicTabbedPaneUI",
"BasicTableHeaderUI", "BasicTableUI", "BasicTextAreaUI", "BasicTextFieldUI",
"BasicTextPaneUI", "BasicTextUI", "BasicToggleButtonUI",
"BasicToolBarSeparatorUI", "BasicToolBarUI", "BasicToolTipUI", "BasicTreeUI",
"BasicViewportUI", "BatchUpdateException", "BeanContext", "BeanContextChild",
"BeanContextChildComponentProxy", "BeanContextChildSupport",
"BeanContextContainerProxy", "BeanContextEvent", "BeanContextMembershipEvent",
"BeanContextMembershipListener", "BeanContextProxy",
"BeanContextServiceAvailableEvent", "BeanContextServiceProvider",
"BeanContextServiceProviderBeanInfo", "BeanContextServiceRevokedEvent",
"BeanContextServiceRevokedListener", "BeanContextServices",
"BeanContextServicesListener", "BeanContextServicesSupport",
"BeanContextSupport", "BeanDescriptor", "BeanInfo", "Beans", "BevelBorder",
"Bidi", "BigDecimal", "BigInteger", "BinaryRefAddr", "BindException", "Binding",
"Binding", "BindingHelper", "BindingHolder", "BindingIterator",
"BindingIteratorHelper", "BindingIteratorHolder", "BindingIteratorOperations",
"BindingIteratorPOA", "BindingListHelper", "BindingListHolder", "BindingType",
"BindingTypeHelper", "BindingTypeHolder", "BitSet", "Blob", "BlockView",
"BlockingQueue", "Book", "Boolean", "BooleanControl", "BooleanHolder",
"BooleanSeqHelper", "BooleanSeqHolder", "Border", "BorderFactory",
"BorderLayout", "BorderUIResource", "BoundedRangeModel", "Bounds", "Bounds",
"Box", "BoxLayout", "BoxView", "BoxedValueHelper", "BreakIterator",
"BrokenBarrierException", "Buffer", "BufferCapabilities",
"BufferOverflowException", "BufferStrategy", "BufferUnderflowException",
"BufferedImage", "BufferedImageFilter", "BufferedImageOp",
"BufferedInputStream", "BufferedOutputStream", "BufferedReader",
"BufferedWriter", "Button", "ButtonGroup", "ButtonModel", "ButtonUI", "Byte",
"ByteArrayInputStream", "ByteArrayOutputStream", "ByteBuffer", "ByteChannel",
"ByteHolder", "ByteLookupTable", "ByteOrder", "CDATASection", "CMMException",
"COMM_FAILURE", "CRC32", "CRL", "CRLException", "CRLSelector", "CSS",
"CTX_RESTRICT_SCOPE", "CacheRequest", "CacheResponse", "CachedRowSet",
"Calendar", "Callable", "CallableStatement", "Callback", "CallbackHandler",
"CancelablePrintJob", "Cancellable", "CancellableTask", "CancellationException",
"CancelledKeyException", "CannotProceed", "CannotProceedException",
"CannotProceedHelper", "CannotProceedHolder", "CannotRedoException",
"CannotUndoException", "Canvas", "CardLayout", "Caret", "CaretEvent",
"CaretListener", "CellEditor", "CellEditorListener", "CellRendererPane",
"CertPath", "CertPathBuilder", "CertPathBuilderException",
"CertPathBuilderResult", "CertPathBuilderSpi", "CertPathParameters",
"CertPathTrustManagerParameters", "CertPathValidator",
"CertPathValidatorException", "CertPathValidatorResult", "CertPathValidatorSpi",
"CertSelector", "CertStore", "CertStoreException", "CertStoreParameters",
"CertStoreSpi", "Certificate", "Certificate", "Certificate",
"CertificateEncodingException", "CertificateEncodingException",
"CertificateException", "CertificateException", "CertificateExpiredException",
"CertificateExpiredException", "CertificateFactory", "CertificateFactorySpi",
"CertificateNotYetValidException", "CertificateNotYetValidException",
"CertificateParsingException", "CertificateParsingException", "ChangeEvent",
"ChangeListener", "ChangedCharSetException", "Channel", "ChannelBinding",
"Channels", "CharArrayReader", "CharArrayWriter", "CharBuffer",
"CharConversionException", "CharHolder", "CharSeqHelper", "CharSeqHolder",
"CharSequence", "Character", "CharacterCodingException", "CharacterData",
"CharacterIterator", "Charset", "CharsetDecoder", "CharsetEncoder",
"CharsetProvider", "Checkbox", "CheckboxGroup", "CheckboxMenuItem",
"CheckedInputStream", "CheckedOutputStream", "Checksum", "Choice",
"ChoiceCallback", "ChoiceFormat", "Chromaticity", "Cipher", "CipherInputStream",
"CipherOutputStream", "CipherSpi", "Class", "ClassCastException",
"ClassCircularityError", "ClassDefinition", "ClassDesc", "ClassFileTransformer",
"ClassFormatError", "ClassLoader", "ClassLoaderRepository", "ClassLoadingMBean",
"ClassNotFoundException", "ClientRequestInfo", "ClientRequestInfoOperations",
"ClientRequestInterceptor", "ClientRequestInterceptorOperations", "Clip",
"Clipboard", "ClipboardOwner", "Clob", "CloneNotSupportedException",
"Cloneable", "Closeable", "ClosedByInterruptException",
"ClosedChannelException", "ClosedSelectorException", "CodeSets", "CodeSigner",
"CodeSource", "Codec", "CodecFactory", "CodecFactoryHelper",
"CodecFactoryOperations", "CodecOperations", "CoderMalfunctionError",
"CoderResult", "CodingErrorAction", "CollationElementIterator", "CollationKey",
"Collator", "Collection", "CollectionCertStoreParameters", "Collections",
"Color", "ColorChooserComponentFactory", "ColorChooserUI", "ColorConvertOp",
"ColorModel", "ColorSelectionModel", "ColorSpace", "ColorSupported",
"ColorType", "ColorUIResource", "ComboBoxEditor", "ComboBoxModel", "ComboBoxUI",
"ComboPopup", "Comment", "CommunicationException", "Comparable", "Comparator",
"CompilationMBean", "Compiler", "CompletionStatus", "CompletionStatusHelper",
"Component", "ComponentAdapter", "ComponentColorModel", "ComponentEvent",
"ComponentIdHelper", "ComponentInputMap", "ComponentInputMapUIResource",
"ComponentListener", "ComponentOrientation", "ComponentSampleModel",
"ComponentUI", "ComponentView", "Composite", "CompositeContext",
"CompositeData", "CompositeDataSupport", "CompositeName", "CompositeType",
"CompositeView", "CompoundBorder", "CompoundControl", "CompoundEdit",
"CompoundName", "Compression", "ConcurrentHashMap", "ConcurrentLinkedQueue",
"ConcurrentMap", "ConcurrentModificationException", "Condition",
"Configuration", "ConfigurationException", "ConfirmationCallback",
"ConnectException", "ConnectIOException", "Connection", "ConnectionEvent",
"ConnectionEventListener", "ConnectionPendingException",
"ConnectionPoolDataSource", "ConsoleHandler", "Constructor", "Container",
"ContainerAdapter", "ContainerEvent", "ContainerListener",
"ContainerOrderFocusTraversalPolicy", "ContentHandler", "ContentHandlerFactory",
"ContentModel", "Context", "ContextList", "ContextNotEmptyException",
"ContextualRenderedImageFactory", "Control", "ControlFactory",
"ControllerEventListener", "ConvolveOp", "CookieHandler", "CookieHolder",
"Copies", "CopiesSupported", "CopyOnWriteArrayList", "CopyOnWriteArraySet",
"CountDownLatch", "CounterMonitor", "CounterMonitorMBean",
"CredentialException", "CredentialExpiredException",
"CredentialNotFoundException", "CropImageFilter", "CubicCurve2D", "Currency",
"Current", "CurrentHelper", "CurrentHelper", "CurrentHelper", "CurrentHolder",
"CurrentOperations", "CurrentOperations", "CurrentOperations", "Cursor",
"CustomMarshal", "CustomValue", "Customizer", "CyclicBarrier",
"DATA_CONVERSION", "DESKeySpec", "DESedeKeySpec", "DGC", "DHGenParameterSpec",
"DHKey", "DHParameterSpec", "DHPrivateKey", "DHPrivateKeySpec", "DHPublicKey",
"DHPublicKeySpec", "DISCARDING", "DOMConfiguration", "DOMError",
"DOMErrorHandler", "DOMException", "DOMImplementation", "DOMImplementationLS",
"DOMImplementationList", "DOMImplementationListImpl",
"DOMImplementationRegistry", "DOMImplementationSource", "DOMLocator",
"DOMLocator", "DOMResult", "DOMSource", "DOMStringList", "DSAKey",
"DSAKeyPairGenerator", "DSAParameterSpec", "DSAParams", "DSAPrivateKey",
"DSAPrivateKeySpec", "DSAPublicKey", "DSAPublicKeySpec", "DTD", "DTDConstants",
"DTDHandler", "DataBuffer", "DataBufferByte", "DataBufferDouble",
"DataBufferFloat", "DataBufferInt", "DataBufferShort", "DataBufferUShort",
"DataFlavor", "DataFormatException", "DataInput", "DataInputStream",
"DataInputStream", "DataLine", "DataOutput", "DataOutputStream",
"DataOutputStream", "DataSource", "DataTruncation", "DatabaseMetaData",
"DatagramChannel", "DatagramPacket", "DatagramSocket", "DatagramSocketImpl",
"DatagramSocketImplFactory", "Date", "Date", "DateFormat", "DateFormatSymbols",
"DateFormatter", "DateTimeAtCompleted", "DateTimeAtCreation",
"DateTimeAtProcessing", "DateTimeSyntax", "DebugGraphics", "DecimalFormat",
"DecimalFormatSymbols", "DeclHandler", "DefaultBoundedRangeModel",
"DefaultButtonModel", "DefaultCaret", "DefaultCellEditor",
"DefaultColorSelectionModel", "DefaultComboBoxModel", "DefaultDesktopManager",
"DefaultEditorKit", "DefaultFocusManager", "DefaultFocusTraversalPolicy",
"DefaultFormatter", "DefaultFormatterFactory", "DefaultHandler",
"DefaultHighlighter", "DefaultKeyboardFocusManager", "DefaultListCellRenderer",
"DefaultListModel", "DefaultListSelectionModel", "DefaultLoaderRepository",
"DefaultLoaderRepository", "DefaultMenuLayout", "DefaultMetalTheme",
"DefaultMutableTreeNode", "DefaultPersistenceDelegate",
"DefaultSingleSelectionModel", "DefaultStyledDocument",
"DefaultTableCellRenderer", "DefaultTableColumnModel", "DefaultTableModel",
"DefaultTextUI", "DefaultTreeCellEditor", "DefaultTreeCellRenderer",
"DefaultTreeModel", "DefaultTreeSelectionModel", "DefinitionKind",
"DefinitionKindHelper", "Deflater", "DeflaterOutputStream", "DelayQueue",
"Delayed", "Delegate", "Delegate", "Delegate", "DelegationPermission",
"Deprecated", "Descriptor", "DescriptorAccess", "DescriptorSupport",
"DesignMode", "DesktopIconUI", "DesktopManager", "DesktopPaneUI", "Destination",
"DestroyFailedException", "Destroyable", "Dialog", "Dictionary",
"DigestException", "DigestInputStream", "DigestOutputStream", "Dimension",
"Dimension2D", "DimensionUIResource", "DirContext", "DirObjectFactory",
"DirStateFactory", "DirectColorModel", "DirectoryManager", "DisplayMode",
"DnDConstants", "Doc", "DocAttribute", "DocAttributeSet", "DocFlavor",
"DocPrintJob", "Document", "Document", "DocumentBuilder",
"DocumentBuilderFactory", "DocumentEvent", "DocumentFilter", "DocumentFragment",
"DocumentHandler", "DocumentListener", "DocumentName", "DocumentParser",
"DocumentType", "Documented", "DomainCombiner", "DomainManager",
"DomainManagerOperations", "Double", "DoubleBuffer", "DoubleHolder",
"DoubleSeqHelper", "DoubleSeqHolder", "DragGestureEvent", "DragGestureListener",
"DragGestureRecognizer", "DragSource", "DragSourceAdapter", "DragSourceContext",
"DragSourceDragEvent", "DragSourceDropEvent", "DragSourceEvent",
"DragSourceListener", "DragSourceMotionListener", "Driver", "DriverManager",
"DriverPropertyInfo", "DropTarget", "DropTargetAdapter", "DropTargetContext",
"DropTargetDragEvent", "DropTargetDropEvent", "DropTargetEvent",
"DropTargetListener", "DuplicateFormatFlagsException", "DuplicateName",
"DuplicateNameHelper", "Duration", "DynAny", "DynAnyFactory",
"DynAnyFactoryHelper", "DynAnyFactoryOperations", "DynAnyHelper",
"DynAnyOperations", "DynAnySeqHelper", "DynArray", "DynArray", "DynArrayHelper",
"DynArrayOperations", "DynEnum", "DynEnum", "DynEnumHelper",
"DynEnumOperations", "DynFixed", "DynFixed", "DynFixedHelper",
"DynFixedOperations", "DynSequence", "DynSequence", "DynSequenceHelper",
"DynSequenceOperations", "DynStruct", "DynStruct", "DynStructHelper",
"DynStructOperations", "DynUnion", "DynUnion", "DynUnionHelper",
"DynUnionOperations", "DynValue", "DynValue", "DynValueBox",
"DynValueBoxOperations", "DynValueCommon", "DynValueCommonOperations",
"DynValueHelper", "DynValueOperations", "DynamicImplementation",
"DynamicImplementation", "DynamicMBean", "ECField", "ECFieldF2m", "ECFieldFp",
"ECGenParameterSpec", "ECKey", "ECParameterSpec", "ECPoint", "ECPrivateKey",
"ECPrivateKeySpec", "ECPublicKey", "ECPublicKeySpec", "ENCODING_CDR_ENCAPS",
"EOFException", "EditorKit", "Element", "ElementIterator", "ElementType",
"Ellipse2D", "EllipticCurve", "EmptyBorder", "EmptyStackException",
"EncodedKeySpec", "Encoder", "Encoding", "EncryptedPrivateKeyInfo", "Entity",
"EntityReference", "EntityResolver", "Enum", "EnumControl", "EnumMap",
"EnumSet", "EnumSyntax", "Enumeration", "Environment", "Error", "ErrorHandler",
"ErrorListener", "ErrorManager", "EtchedBorder", "Event", "EventContext",
"EventDirContext", "EventHandler", "EventListener", "EventListenerList",
"EventListenerProxy", "EventObject", "EventQueue", "EventSetDescriptor",
"Exception", "ExceptionDetailMessage", "ExceptionInInitializerError",
"ExceptionList", "ExceptionListener", "Exchanger", "ExecutionException",
"Executor", "ExecutorService", "Executors", "ExemptionMechanism",
"ExemptionMechanismException", "ExemptionMechanismSpi", "ExpandVetoException",
"ExportException", "Expression", "ExtendedRequest", "ExtendedResponse",
"Externalizable", "FREE_MEM", "FactoryConfigurationError",
"FailedLoginException", "FeatureDescriptor", "Fidelity", "Field",
"FieldNameHelper", "FieldPosition", "FieldView", "File",
"FileCacheImageInputStream", "FileCacheImageOutputStream", "FileChannel",
"FileChooserUI", "FileDialog", "FileFilter", "FileHandler",
"FileImageInputStream", "FileImageOutputStream", "FileInputStream", "FileLock",
"FileLockInterruptionException", "FileNameMap", "FileNotFoundException",
"FileOutputStream", "FilePermission", "FileReader", "FileSystemView",
"FileView", "FileWriter", "FilenameFilter", "Filter", "FilterInputStream",
"FilterOutputStream", "FilterReader", "FilterWriter", "FilteredImageSource",
"FilteredRowSet", "Finishings", "FixedHeightLayoutCache", "FixedHolder",
"FlatteningPathIterator", "FlavorEvent", "FlavorException", "FlavorListener",
"FlavorMap", "FlavorTable", "Float", "FloatBuffer", "FloatControl",
"FloatHolder", "FloatSeqHelper", "FloatSeqHolder", "FlowLayout", "FlowView",
"FocusAdapter", "FocusEvent", "FocusListener", "FocusManager",
"FocusTraversalPolicy", "Font", "FontFormatException", "FontMetrics",
"FontRenderContext", "FontUIResource", "FormSubmitEvent", "FormView", "Format",
"FormatConversionProvider", "FormatFlagsConversionMismatchException",
"FormatMismatch", "FormatMismatchHelper", "Formattable", "Formatter",
"Formatter", "FormatterClosedException", "ForwardRequest", "ForwardRequest",
"ForwardRequestHelper", "ForwardRequestHelper", "Frame", "Future", "FutureTask",
"GSSContext", "GSSCredential", "GSSException", "GSSManager", "GSSName",
"GZIPInputStream", "GZIPOutputStream", "GapContent", "GarbageCollectorMBean",
"GatheringByteChannel", "GaugeMonitor", "GaugeMonitorMBean", "GeneralPath",
"GeneralSecurityException", "GenericArrayType", "GenericDeclaration",
"GenericSignatureFormatError", "GlyphJustificationInfo", "GlyphMetrics",
"GlyphVector", "GlyphView", "GradientPaint", "GraphicAttribute", "Graphics",
"Graphics2D", "GraphicsConfigTemplate", "GraphicsConfiguration",
"GraphicsDevice", "GraphicsEnvironment", "GrayFilter", "GregorianCalendar",
"GridBagConstraints", "GridBagLayout", "GridLayout", "Group", "Guard",
"GuardedObject", "HOLDING", "HTML", "HTMLDocument", "HTMLEditorKit",
"HTMLFrameHyperlinkEvent", "HTMLWriter", "Handler", "HandlerBase",
"HandshakeCompletedEvent", "HandshakeCompletedListener", "HasControls",
"HashAttributeSet", "HashDocAttributeSet", "HashMap",
"HashPrintJobAttributeSet", "HashPrintRequestAttributeSet",
"HashPrintServiceAttributeSet", "HashSet", "Hashtable", "HeadlessException",
"HierarchyBoundsAdapter", "HierarchyBoundsListener", "HierarchyEvent",
"HierarchyListener", "Highlighter", "HostnameVerifier", "HttpURLConnection",
"HttpsURLConnection", "HyperlinkEvent", "HyperlinkListener", "ICC_ColorSpace",
"ICC_Profile", "ICC_ProfileGray", "ICC_ProfileRGB", "IDLEntity", "IDLType",
"IDLTypeHelper", "IDLTypeOperations", "ID_ASSIGNMENT_POLICY_ID",
"ID_UNIQUENESS_POLICY_ID", "IIOByteBuffer", "IIOException", "IIOImage",
"IIOInvalidTreeException", "IIOMetadata", "IIOMetadataController",
"IIOMetadataFormat", "IIOMetadataFormatImpl", "IIOMetadataNode", "IIOParam",
"IIOParamController", "IIOReadProgressListener", "IIOReadUpdateListener",
"IIOReadWarningListener", "IIORegistry", "IIOServiceProvider",
"IIOWriteProgressListener", "IIOWriteWarningListener",
"IMPLICIT_ACTIVATION_POLICY_ID", "IMP_LIMIT", "INACTIVE", "INITIALIZE",
"INTERNAL", "INTF_REPOS", "INVALID_TRANSACTION", "INV_FLAG", "INV_IDENT",
"INV_OBJREF", "INV_POLICY", "IOException", "IOR", "IORHelper", "IORHolder",
"IORInfo", "IORInfoOperations", "IORInterceptor", "IORInterceptorOperations",
"IORInterceptor_3_0", "IORInterceptor_3_0Helper", "IORInterceptor_3_0Holder",
"IORInterceptor_3_0Operations", "IRObject", "IRObjectOperations", "Icon",
"IconUIResource", "IconView", "IdAssignmentPolicy",
"IdAssignmentPolicyOperations", "IdAssignmentPolicyValue", "IdUniquenessPolicy",
"IdUniquenessPolicyOperations", "IdUniquenessPolicyValue", "IdentifierHelper",
"Identity", "IdentityHashMap", "IdentityScope", "IllegalAccessError",
"IllegalAccessException", "IllegalArgumentException",
"IllegalBlockSizeException", "IllegalBlockingModeException",
"IllegalCharsetNameException", "IllegalClassFormatException",
"IllegalComponentStateException", "IllegalFormatCodePointException",
"IllegalFormatConversionException", "IllegalFormatException",
"IllegalFormatFlagsException", "IllegalFormatPrecisionException",
"IllegalFormatWidthException", "IllegalMonitorStateException",
"IllegalPathStateException", "IllegalSelectorException",
"IllegalStateException", "IllegalThreadStateException", "Image",
"ImageCapabilities", "ImageConsumer", "ImageFilter", "ImageGraphicAttribute",
"ImageIO", "ImageIcon", "ImageInputStream", "ImageInputStreamImpl",
"ImageInputStreamSpi", "ImageObserver", "ImageOutputStream",
"ImageOutputStreamImpl", "ImageOutputStreamSpi", "ImageProducer",
"ImageReadParam", "ImageReader", "ImageReaderSpi", "ImageReaderWriterSpi",
"ImageTranscoder", "ImageTranscoderSpi", "ImageTypeSpecifier", "ImageView",
"ImageWriteParam", "ImageWriter", "ImageWriterSpi", "ImagingOpException",
"ImplicitActivationPolicy", "ImplicitActivationPolicyOperations",
"ImplicitActivationPolicyValue", "IncompatibleClassChangeError",
"IncompleteAnnotationError", "InconsistentTypeCode", "InconsistentTypeCode",
"InconsistentTypeCodeHelper", "IndexColorModel", "IndexOutOfBoundsException",
"IndexedPropertyChangeEvent", "IndexedPropertyDescriptor",
"IndirectionException", "Inet4Address", "Inet6Address", "InetAddress",
"InetSocketAddress", "Inflater", "InflaterInputStream",
"InheritableThreadLocal", "Inherited", "InitialContext",
"InitialContextFactory", "InitialContextFactoryBuilder", "InitialDirContext",
"InitialLdapContext", "InlineView", "InputContext", "InputEvent", "InputMap",
"InputMapUIResource", "InputMethod", "InputMethodContext",
"InputMethodDescriptor", "InputMethodEvent", "InputMethodHighlight",
"InputMethodListener", "InputMethodRequests", "InputMismatchException",
"InputSource", "InputStream", "InputStream", "InputStream", "InputStreamReader",
"InputSubset", "InputVerifier", "Insets", "InsetsUIResource",
"InstanceAlreadyExistsException", "InstanceNotFoundException",
"InstantiationError", "InstantiationException", "Instrument", "Instrumentation",
"InsufficientResourcesException", "IntBuffer", "IntHolder", "Integer",
"IntegerSyntax", "Interceptor", "InterceptorOperations", "InternalError",
"InternalFrameAdapter", "InternalFrameEvent",
"InternalFrameFocusTraversalPolicy", "InternalFrameListener", "InternalFrameUI",
"InternationalFormatter", "InterruptedException", "InterruptedIOException",
"InterruptedNamingException", "InterruptibleChannel", "IntrospectionException",
"IntrospectionException", "Introspector", "Invalid", "InvalidAddress",
"InvalidAddressHelper", "InvalidAddressHolder",
"InvalidAlgorithmParameterException", "InvalidApplicationException",
"InvalidAttributeIdentifierException", "InvalidAttributeValueException",
"InvalidAttributeValueException", "InvalidAttributesException",
"InvalidClassException", "InvalidDnDOperationException", "InvalidKeyException",
"InvalidKeyException", "InvalidKeySpecException", "InvalidMarkException",
"InvalidMidiDataException", "InvalidName", "InvalidName", "InvalidName",
"InvalidNameException", "InvalidNameHelper", "InvalidNameHelper",
"InvalidNameHolder", "InvalidObjectException", "InvalidOpenTypeException",
"InvalidParameterException", "InvalidParameterSpecException", "InvalidPolicy",
"InvalidPolicyHelper", "InvalidPreferencesFormatException",
"InvalidPropertiesFormatException", "InvalidRelationIdException",
"InvalidRelationServiceException", "InvalidRelationTypeException",
"InvalidRoleInfoException", "InvalidRoleValueException",
"InvalidSearchControlsException", "InvalidSearchFilterException", "InvalidSeq",
"InvalidSlot", "InvalidSlotHelper", "InvalidTargetObjectTypeException",
"InvalidTransactionException", "InvalidTypeForEncoding",
"InvalidTypeForEncodingHelper", "InvalidValue", "InvalidValue",
"InvalidValueHelper", "InvocationEvent", "InvocationHandler",
"InvocationTargetException", "InvokeHandler", "IstringHelper", "ItemEvent",
"ItemListener", "ItemSelectable", "Iterable", "Iterator", "IvParameterSpec",
"JApplet", "JButton", "JCheckBox", "JCheckBoxMenuItem", "JColorChooser",
"JComboBox", "JComponent", "JDesktopPane", "JDialog", "JEditorPane",
"JFileChooser", "JFormattedTextField", "JFrame", "JInternalFrame", "JLabel",
"JLayeredPane", "JList", "JMException", "JMRuntimeException",
"JMXAuthenticator", "JMXConnectionNotification", "JMXConnector",
"JMXConnectorFactory", "JMXConnectorProvider", "JMXConnectorServer",
"JMXConnectorServerFactory", "JMXConnectorServerMBean",
"JMXConnectorServerProvider", "JMXPrincipal", "JMXProviderException",
"JMXServerErrorException", "JMXServiceURL", "JMenu", "JMenuBar", "JMenuItem",
"JOptionPane", "JPEGHuffmanTable", "JPEGImageReadParam", "JPEGImageWriteParam",
"JPEGQTable", "JPanel", "JPasswordField", "JPopupMenu", "JPopupMenu.Separator",
"JProgressBar", "JRadioButton", "JRadioButtonMenuItem", "JRootPane",
"JScrollBar", "JScrollPane", "JSeparator", "JSlider", "JSpinner", "JSplitPane",
"JTabbedPane", "JTable", "JTable.PrintMode", "JTableHeader", "JTextArea",
"JTextComponent", "JTextField", "JTextPane", "JToggleButton", "JToolBar",
"JToolBar.Separator", "JToolTip", "JTree", "JViewport", "JWindow", "JarEntry",
"JarException", "JarFile", "JarInputStream", "JarOutputStream",
"JarURLConnection", "JdbcRowSet", "JobAttributes", "JobHoldUntil",
"JobImpressions", "JobImpressionsCompleted", "JobImpressionsSupported",
"JobKOctets", "JobKOctetsProcessed", "JobKOctetsSupported", "JobMediaSheets",
"JobMediaSheetsCompleted", "JobMediaSheetsSupported", "JobMessageFromOperator",
"JobName", "JobOriginatingUserName", "JobPriority", "JobPrioritySupported",
"JobSheets", "JobState", "JobStateReason", "JobStateReasons", "JoinRowSet",
"Joinable", "KerberosKey", "KerberosPrincipal", "KerberosTicket", "Kernel",
"Key", "KeyAdapter", "KeyAgreement", "KeyAgreementSpi",
"KeyAlreadyExistsException", "KeyEvent", "KeyEventDispatcher",
"KeyEventPostProcessor", "KeyException", "KeyFactory", "KeyFactorySpi",
"KeyGenerator", "KeyGeneratorSpi", "KeyListener", "KeyManagementException",
"KeyManager", "KeyManagerFactory", "KeyManagerFactorySpi", "KeyPair",
"KeyPairGenerator", "KeyPairGeneratorSpi", "KeyRep", "KeyRep.Type", "KeySpec",
"KeyStore", "KeyStoreBuilderParameters", "KeyStoreException", "KeyStoreSpi",
"KeyStroke", "KeyboardFocusManager", "Keymap", "LDAPCertStoreParameters",
"LIFESPAN_POLICY_ID", "LOCATION_FORWARD", "LSInput", "LSLoadEvent", "LSOutput",
"LSParser", "LSParserFilter", "LSProgressEvent", "LSResourceResolver",
"LSSerializer", "LSSerializerFilter", "Label", "LabelUI", "LabelView",
"LanguageCallback", "LastOwnerException", "LayeredHighlighter",
"LayeredHighlighter.LayerPainter", "LayoutFocusTraversalPolicy",
"LayoutManager", "LayoutManager2", "LayoutQueue", "LdapContext", "LdapName",
"LdapReferralException", "Lease", "Level", "LexicalHandler", "LifespanPolicy",
"LifespanPolicyOperations", "LifespanPolicyValue", "LimitExceededException",
"Line", "Line.Info", "Line2D", "Line2D.Double", "Line2D.Float", "LineBorder",
"LineBreakMeasurer", "LineEvent", "LineEvent.Type", "LineListener",
"LineMetrics", "LineNumberInputStream", "LineNumberReader",
"LineUnavailableException", "LinkException", "LinkLoopException", "LinkRef",
"LinkageError", "LinkedBlockingQueue", "LinkedHashMap", "LinkedHashSet",
"LinkedList", "List", "List", "ListCellRenderer", "ListDataEvent",
"ListDataListener", "ListIterator", "ListModel", "ListResourceBundle",
"ListSelectionEvent", "ListSelectionListener", "ListSelectionModel", "ListUI",
"ListView", "ListenerNotFoundException", "LoaderHandler", "LocalObject",
"Locale", "LocateRegistry", "Locator", "LocatorImpl", "Lock", "LockSupport",
"LogManager", "LogRecord", "LogStream", "Logger", "LoggingPermission",
"LoginContext", "LoginException", "LoginModule", "Long", "LongBuffer",
"LongHolder", "LongLongSeqHelper", "LongLongSeqHolder", "LongSeqHelper",
"LongSeqHolder", "LookAndFeel", "LookupOp", "LookupTable", "MARSHAL",
"MBeanAttributeInfo", "MBeanConstructorInfo", "MBeanException",
"MBeanFeatureInfo", "MBeanInfo", "MBeanNotificationInfo", "MBeanOperationInfo",
"MBeanParameterInfo", "MBeanPermission", "MBeanRegistration",
"MBeanRegistrationException", "MBeanServer", "MBeanServerBuilder",
"MBeanServerConnection", "MBeanServerDelegate", "MBeanServerDelegateMBean",
"MBeanServerFactory", "MBeanServerForwarder", "MBeanServerInvocationHandler",
"MBeanServerNotification", "MBeanServerNotificationFilter",
"MBeanServerPermission", "MBeanTrustPermission", "MGF1ParameterSpec", "MLet",
"MLetMBean", "Mac", "MacSpi", "MalformedInputException",
"MalformedLinkException", "MalformedObjectNameException",
"MalformedParameterizedTypeException", "MalformedURLException",
"ManageReferralControl", "ManagementFactory", "ManagementPermission",
"ManagerFactoryParameters", "Manifest", "Map", "Map.Entry", "MappedByteBuffer",
"MarshalException", "MarshalledObject", "MaskFormatter", "MatchResult",
"Matcher", "Math", "MathContext", "MatteBorder", "Media", "MediaName",
"MediaPrintableArea", "MediaSize", "MediaSize.Engineering", "MediaSize.ISO",
"MediaSize.JIS", "MediaSize.NA", "MediaSize.Other", "MediaSizeName",
"MediaTracker", "MediaTray", "Member", "MemoryCacheImageInputStream",
"MemoryCacheImageOutputStream", "MemoryHandler", "MemoryImageSource",
"MemoryMBean", "MemoryManagerMBean", "MemoryNotification", "MemoryPoolMBean",
"MemoryType", "MemoryUsage", "Menu", "MenuBar", "MenuBarUI", "MenuComponent",
"MenuContainer", "MenuDragMouseEvent", "MenuDragMouseListener", "MenuElement",
"MenuEvent", "MenuItem", "MenuItemUI", "MenuKeyEvent", "MenuKeyListener",
"MenuListener", "MenuSelectionManager", "MenuShortcut", "MessageDigest",
"MessageDigestSpi", "MessageFormat", "MessageFormat.Field", "MessageProp",
"MetaEventListener", "MetaMessage", "MetalBorders", "MetalButtonUI",
"MetalCheckBoxIcon", "MetalCheckBoxUI", "MetalComboBoxButton",
"MetalComboBoxEditor", "MetalComboBoxEditor.UIResource", "MetalComboBoxIcon",
"MetalComboBoxUI", "MetalDesktopIconUI", "MetalFileChooserUI",
"MetalIconFactory", "MetalInternalFrameTitlePane", "MetalInternalFrameUI",
"MetalLabelUI", "MetalLookAndFeel", "MetalMenuBarUI",
"MetalPopupMenuSeparatorUI", "MetalProgressBarUI", "MetalRadioButtonUI",
"MetalRootPaneUI", "MetalScrollBarUI", "MetalScrollButton", "MetalScrollPaneUI",
"MetalSeparatorUI", "MetalSliderUI", "MetalSplitPaneUI", "MetalTabbedPaneUI",
"MetalTextFieldUI", "MetalTheme", "MetalToggleButtonUI", "MetalToolBarUI",
"MetalToolTipUI", "MetalTreeUI", "Method", "MethodDescriptor", "MidiChannel",
"MidiDevice", "MidiDevice.Info", "MidiDeviceProvider", "MidiEvent",
"MidiFileFormat", "MidiFileReader", "MidiFileWriter", "MidiMessage",
"MidiSystem", "MidiUnavailableException", "MimeTypeParseException",
"MinimalHTMLWriter", "MissingFormatArgumentException",
"MissingFormatWidthException", "MissingResourceException", "Mixer",
"Mixer.Info", "MixerProvider", "ModelMBean", "ModelMBeanAttributeInfo",
"ModelMBeanConstructorInfo", "ModelMBeanInfo", "ModelMBeanInfoSupport",
"ModelMBeanNotificationBroadcaster", "ModelMBeanNotificationInfo",
"ModelMBeanOperationInfo", "ModificationItem", "Modifier", "Monitor",
"MonitorMBean", "MonitorNotification", "MonitorSettingException",
"MouseAdapter", "MouseDragGestureRecognizer", "MouseEvent", "MouseInfo",
"MouseInputAdapter", "MouseInputListener", "MouseListener",
"MouseMotionAdapter", "MouseMotionListener", "MouseWheelEvent",
"MouseWheelListener", "MultiButtonUI", "MultiColorChooserUI", "MultiComboBoxUI",
"MultiDesktopIconUI", "MultiDesktopPaneUI", "MultiDoc", "MultiDocPrintJob",
"MultiDocPrintService", "MultiFileChooserUI", "MultiInternalFrameUI",
"MultiLabelUI", "MultiListUI", "MultiLookAndFeel", "MultiMenuBarUI",
"MultiMenuItemUI", "MultiOptionPaneUI", "MultiPanelUI",
"MultiPixelPackedSampleModel", "MultiPopupMenuUI", "MultiProgressBarUI",
"MultiRootPaneUI", "MultiScrollBarUI", "MultiScrollPaneUI", "MultiSeparatorUI",
"MultiSliderUI", "MultiSpinnerUI", "MultiSplitPaneUI", "MultiTabbedPaneUI",
"MultiTableHeaderUI", "MultiTableUI", "MultiTextUI", "MultiToolBarUI",
"MultiToolTipUI", "MultiTreeUI", "MultiViewportUI", "MulticastSocket",
"MultipleComponentProfileHelper", "MultipleComponentProfileHolder",
"MultipleDocumentHandling", "MultipleMaster", "MutableAttributeSet",
"MutableComboBoxModel", "MutableTreeNode", "NON_EXISTENT", "NO_IMPLEMENT",
"NO_MEMORY", "NO_PERMISSION", "NO_RESOURCES", "NO_RESPONSE", "NVList", "Name",
"NameAlreadyBoundException", "NameCallback", "NameClassPair", "NameComponent",
"NameComponentHelper", "NameComponentHolder", "NameDynAnyPair",
"NameDynAnyPairHelper", "NameDynAnyPairSeqHelper", "NameHelper", "NameHolder",
"NameList", "NameNotFoundException", "NameParser", "NameValuePair",
"NameValuePair", "NameValuePairHelper", "NameValuePairHelper",
"NameValuePairSeqHelper", "NamedNodeMap", "NamedValue",
"NamespaceChangeListener", "NamespaceContext", "NamespaceSupport", "Naming",
"NamingContext", "NamingContextExt", "NamingContextExtHelper",
"NamingContextExtHolder", "NamingContextExtOperations", "NamingContextExtPOA",
"NamingContextHelper", "NamingContextHolder", "NamingContextOperations",
"NamingContextPOA", "NamingEnumeration", "NamingEvent", "NamingException",
"NamingExceptionEvent", "NamingListener", "NamingManager",
"NamingSecurityException", "NavigationFilter", "NavigationFilter.FilterBypass",
"NegativeArraySizeException", "NetPermission", "NetworkInterface",
"NoClassDefFoundError", "NoConnectionPendingException", "NoContext",
"NoContextHelper", "NoInitialContextException", "NoPermissionException",
"NoRouteToHostException", "NoServant", "NoServantHelper",
"NoSuchAlgorithmException", "NoSuchAttributeException",
"NoSuchElementException", "NoSuchFieldError", "NoSuchFieldException",
"NoSuchMethodError", "NoSuchMethodException", "NoSuchObjectException",
"NoSuchPaddingException", "NoSuchProviderException", "Node", "NodeChangeEvent",
"NodeChangeListener", "NodeList", "NonReadableChannelException",
"NonWritableChannelException", "NoninvertibleTransformException",
"NotActiveException", "NotBoundException", "NotCompliantMBeanException",
"NotContextException", "NotEmpty", "NotEmptyHelper", "NotEmptyHolder",
"NotFound", "NotFoundHelper", "NotFoundHolder", "NotFoundReason",
"NotFoundReasonHelper", "NotFoundReasonHolder", "NotOwnerException",
"NotSerializableException", "NotYetBoundException", "NotYetConnectedException",
"Notation", "Notification", "NotificationBroadcaster",
"NotificationBroadcasterSupport", "NotificationEmitter", "NotificationFilter",
"NotificationFilterSupport", "NotificationListener", "NotificationResult",
"NullCipher", "NullPointerException", "Number", "NumberFormat",
"NumberFormat.Field", "NumberFormatException", "NumberFormatter",
"NumberOfDocuments", "NumberOfInterveningJobs", "NumberUp", "NumberUpSupported",
"NumericShaper", "OAEPParameterSpec", "OBJECT_NOT_EXIST", "OBJ_ADAPTER",
"OMGVMCID", "ORB", "ORB", "ORBIdHelper", "ORBInitInfo", "ORBInitInfoOperations",
"ORBInitializer", "ORBInitializerOperations", "ObjID", "Object", "Object",
"ObjectAlreadyActive", "ObjectAlreadyActiveHelper", "ObjectChangeListener",
"ObjectFactory", "ObjectFactoryBuilder", "ObjectHelper", "ObjectHolder",
"ObjectIdHelper", "ObjectIdHelper", "ObjectImpl", "ObjectImpl", "ObjectInput",
"ObjectInputStream", "ObjectInputStream.GetField", "ObjectInputValidation",
"ObjectInstance", "ObjectName", "ObjectNotActive", "ObjectNotActiveHelper",
"ObjectOutput", "ObjectOutputStream", "ObjectOutputStream.PutField",
"ObjectReferenceFactory", "ObjectReferenceFactoryHelper",
"ObjectReferenceFactoryHolder", "ObjectReferenceTemplate",
"ObjectReferenceTemplateHelper", "ObjectReferenceTemplateHolder",
"ObjectReferenceTemplateSeqHelper", "ObjectReferenceTemplateSeqHolder",
"ObjectStreamClass", "ObjectStreamConstants", "ObjectStreamException",
"ObjectStreamField", "ObjectView", "Observable", "Observer", "OctetSeqHelper",
"OctetSeqHolder", "Oid", "OpenDataException", "OpenMBeanAttributeInfo",
"OpenMBeanAttributeInfoSupport", "OpenMBeanConstructorInfo",
"OpenMBeanConstructorInfoSupport", "OpenMBeanInfo", "OpenMBeanInfoSupport",
"OpenMBeanOperationInfo", "OpenMBeanOperationInfoSupport",
"OpenMBeanParameterInfo", "OpenMBeanParameterInfoSupport", "OpenType",
"OpenType", "OperatingSystemMBean", "Operation",
"OperationNotSupportedException", "OperationsException", "Option",
"OptionPaneUI", "OptionalDataException", "OrientationRequested",
"OutOfMemoryError", "OutputDeviceAssigned", "OutputKeys", "OutputStream",
"OutputStream", "OutputStream", "OutputStreamWriter",
"OverlappingFileLockException", "OverlayLayout", "Overrides", "Owner", "PBEKey",
"PBEKeySpec", "PBEParameterSpec", "PDLOverrideSupported", "PERSIST_STORE",
"PKCS8EncodedKeySpec", "PKIXBuilderParameters", "PKIXCertPathBuilderResult",
"PKIXCertPathChecker", "PKIXCertPathValidatorResult", "PKIXParameters", "POA",
"POAHelper", "POAManager", "POAManagerOperations", "POAOperations",
"PRIVATE_MEMBER", "PSSParameterSpec", "PSource", "PSource.PSpecified",
"PUBLIC_MEMBER", "Pack200", "Package", "PackedColorModel", "PageAttributes",
"PageFormat", "PageRanges", "Pageable", "PagedResultsControl",
"PagedResultsResponseControl", "PagesPerMinute", "PagesPerMinuteColor", "Paint",
"PaintContext", "PaintEvent", "Panel", "PanelUI", "Paper", "ParagraphView",
"ParagraphView", "Parameter", "ParameterBlock", "ParameterDescriptor",
"ParameterMetaData", "ParameterMode", "ParameterModeHelper",
"ParameterModeHolder", "ParameterizedType", "ParseException", "ParsePosition",
"Parser", "Parser", "ParserAdapter", "ParserConfigurationException",
"ParserDelegator", "ParserFactory", "PartialResultException",
"PasswordAuthentication", "PasswordCallback", "PasswordView", "Patch",
"PathIterator", "Pattern", "PatternSyntaxException", "Permission", "Permission",
"PermissionCollection", "Permissions", "PersistenceDelegate", "PersistentMBean",
"PhantomReference", "Pipe", "Pipe.SinkChannel", "Pipe.SourceChannel",
"PipedInputStream", "PipedOutputStream", "PipedReader", "PipedWriter",
"PixelGrabber", "PixelInterleavedSampleModel", "PlainDocument", "PlainView",
"Point", "Point2D", "Point2D.Double", "Point2D.Float", "PointerInfo", "Policy",
"Policy", "Policy", "PolicyError", "PolicyErrorCodeHelper", "PolicyErrorHelper",
"PolicyErrorHolder", "PolicyFactory", "PolicyFactoryOperations", "PolicyHelper",
"PolicyHolder", "PolicyListHelper", "PolicyListHolder", "PolicyNode",
"PolicyOperations", "PolicyQualifierInfo", "PolicyTypeHelper", "Polygon",
"PooledConnection", "Popup", "PopupFactory", "PopupMenu", "PopupMenuEvent",
"PopupMenuListener", "PopupMenuUI", "Port", "Port.Info",
"PortUnreachableException", "PortableRemoteObject",
"PortableRemoteObjectDelegate", "Position", "Position.Bias", "Predicate",
"PreferenceChangeEvent", "PreferenceChangeListener", "Preferences",
"PreferencesFactory", "PreparedStatement", "PresentationDirection", "Principal",
"Principal", "PrincipalHolder", "PrintEvent", "PrintException", "PrintGraphics",
"PrintJob", "PrintJobAdapter", "PrintJobAttribute", "PrintJobAttributeEvent",
"PrintJobAttributeListener", "PrintJobAttributeSet", "PrintJobEvent",
"PrintJobListener", "PrintQuality", "PrintRequestAttribute",
"PrintRequestAttributeSet", "PrintService", "PrintServiceAttribute",
"PrintServiceAttributeEvent", "PrintServiceAttributeListener",
"PrintServiceAttributeSet", "PrintServiceLookup", "PrintStream", "PrintWriter",
"Printable", "PrinterAbortException", "PrinterException", "PrinterGraphics",
"PrinterIOException", "PrinterInfo", "PrinterIsAcceptingJobs", "PrinterJob",
"PrinterLocation", "PrinterMakeAndModel", "PrinterMessageFromOperator",
"PrinterMoreInfo", "PrinterMoreInfoManufacturer", "PrinterName",
"PrinterResolution", "PrinterState", "PrinterStateReason",
"PrinterStateReasons", "PrinterURI", "PriorityBlockingQueue", "PriorityQueue",
"PrivateClassLoader", "PrivateCredentialPermission", "PrivateKey",
"PrivateMLet", "PrivilegedAction", "PrivilegedActionException",
"PrivilegedExceptionAction", "PrivilegedFutureTask", "Process",
"ProcessBuilder", "ProcessingInstruction", "ProfileDataException",
"ProfileIdHelper", "ProgressBarUI", "ProgressMonitor",
"ProgressMonitorInputStream", "Properties", "PropertyChangeEvent",
"PropertyChangeListener", "PropertyChangeListenerProxy",
"PropertyChangeSupport", "PropertyDescriptor", "PropertyEditor",
"PropertyEditorManager", "PropertyEditorSupport", "PropertyPermission",
"PropertyResourceBundle", "PropertyVetoException", "ProtectionDomain",
"ProtocolException", "Provider", "Provider.Service", "ProviderException",
"Proxy", "Proxy", "Proxy.Type", "ProxySelector", "PublicKey",
"PushbackInputStream", "PushbackReader", "QName", "QuadCurve2D",
"QuadCurve2D.Double", "QuadCurve2D.Float", "Query", "QueryEval", "QueryExp",
"Queue", "QueuedJobCount", "RC2ParameterSpec", "RC5ParameterSpec",
"REQUEST_PROCESSING_POLICY_ID", "RGBImageFilter", "RMIClassLoader",
"RMIClassLoaderSpi", "RMIClientSocketFactory", "RMIConnection",
"RMIConnectionImpl", "RMIConnector", "RMIConnectorServer",
"RMICustomMaxStreamFormat", "RMIFailureHandler", "RMIIIOPServerImpl",
"RMIJRMPServerImpl", "RMISecurityException", "RMISecurityManager", "RMIServer",
"RMIServerImpl", "RMIServerSocketFactory", "RMISocketFactory", "RSAKey",
"RSAKeyGenParameterSpec", "RSAMultiPrimePrivateCrtKey",
"RSAMultiPrimePrivateCrtKeySpec", "RSAOtherPrimeInfo", "RSAPrivateCrtKey",
"RSAPrivateCrtKeySpec", "RSAPrivateKey", "RSAPrivateKeySpec", "RSAPublicKey",
"RSAPublicKeySpec", "RTFEditorKit", "Random", "RandomAccess",
"RandomAccessFile", "Raster", "RasterFormatException", "RasterOp", "Rdn",
"ReadOnlyBufferException", "ReadWriteLock", "Readable", "ReadableByteChannel",
"Reader", "RealmCallback", "RealmChoiceCallback", "Receiver", "Rectangle",
"Rectangle2D", "Rectangle2D.Double", "Rectangle2D.Float", "RectangularShape",
"ReentrantLock", "ReentrantLock.ConditionObject", "ReentrantReadWriteLock",
"ReentrantReadWriteLock.WriterConditionObject", "Ref", "RefAddr", "Reference",
"Reference", "ReferenceQueue", "ReferenceUriSchemesSupported", "Referenceable",
"ReferralException", "ReflectPermission", "ReflectionException",
"RefreshFailedException", "Refreshable", "Region", "RegisterableService",
"Registry", "RegistryHandler", "RejectedExecutionException",
"RejectedExecutionHandler", "Relation", "RelationException",
"RelationNotFoundException", "RelationNotification", "RelationService",
"RelationServiceMBean", "RelationServiceNotRegisteredException",
"RelationSupport", "RelationSupportMBean", "RelationType",
"RelationTypeNotFoundException", "RelationTypeSupport", "RemarshalException",
"Remote", "RemoteCall", "RemoteException", "RemoteObject",
"RemoteObjectInvocationHandler", "RemoteRef", "RemoteServer", "RemoteStub",
"RenderContext", "RenderableImage", "RenderableImageOp",
"RenderableImageProducer", "RenderedImage", "RenderedImageFactory", "Renderer",
"RenderingHints", "RenderingHints.Key", "RepaintManager",
"ReplicateScaleFilter", "RepositoryIdHelper", "Request", "RequestInfo",
"RequestInfoOperations", "RequestProcessingPolicy",
"RequestProcessingPolicyOperations", "RequestProcessingPolicyValue",
"RequestingUserName", "RequiredModelMBean", "RescaleOp", "ResolutionSyntax",
"ResolveResult", "Resolver", "ResourceBundle", "ResponseCache",
"ResponseHandler", "Result", "ResultSet", "ResultSetMetaData", "Retention",
"RetentionPolicy", "ReverbType", "Robot", "Role", "RoleInfo",
"RoleInfoNotFoundException", "RoleList", "RoleNotFoundException", "RoleResult",
"RoleStatus", "RoleUnresolved", "RoleUnresolvedList", "RootPaneContainer",
"RootPaneUI", "RoundRectangle2D", "RoundRectangle2D.Double",
"RoundRectangle2D.Float", "RoundingMode", "RowMapper", "RowSet", "RowSetEvent",
"RowSetInternal", "RowSetListener", "RowSetMetaData", "RowSetMetaDataImpl",
"RowSetReader", "RowSetWarning", "RowSetWriter", "RuleBasedCollator", "RunTime",
"RunTimeOperations", "Runnable", "Runtime", "RuntimeErrorException",
"RuntimeException", "RuntimeMBean", "RuntimeMBeanException",
"RuntimeOperationsException", "RuntimePermission", "SAXException",
"SAXNotRecognizedException", "SAXNotSupportedException", "SAXParseException",
"SAXParser", "SAXParserFactory", "SAXResult", "SAXSource",
"SAXTransformerFactory", "SERVANT_RETENTION_POLICY_ID", "SQLData",
"SQLException", "SQLInput", "SQLInputImpl", "SQLOutput", "SQLOutputImpl",
"SQLPermission", "SQLWarning", "SSLContext", "SSLContextSpi", "SSLEngine",
"SSLEngineResult", "SSLEngineResult.HandshakeStatus", "SSLEngineResult.Status",
"SSLException", "SSLHandshakeException", "SSLKeyException",
"SSLPeerUnverifiedException", "SSLPermission", "SSLProtocolException",
"SSLServerSocket", "SSLServerSocketFactory", "SSLSession",
"SSLSessionBindingEvent", "SSLSessionBindingListener", "SSLSessionContext",
"SSLSocket", "SSLSocketFactory", "SUCCESSFUL", "SYNC_WITH_TRANSPORT",
"SYSTEM_EXCEPTION", "SampleModel", "Sasl", "SaslClient", "SaslClientFactory",
"SaslException", "SaslServer", "SaslServerFactory", "Savepoint", "Scanner",
"ScatteringByteChannel", "ScheduledCancellable", "ScheduledExecutor",
"ScheduledFuture", "Schema", "SchemaFactory", "SchemaFactoryFinder",
"SchemaFactoryLoader", "SchemaViolationException", "ScrollBarUI", "ScrollPane",
"ScrollPaneAdjustable", "ScrollPaneConstants", "ScrollPaneLayout",
"ScrollPaneLayout.UIResource", "ScrollPaneUI", "Scrollable", "Scrollbar",
"SealedObject", "SearchControls", "SearchResult", "SecretKey",
"SecretKeyFactory", "SecretKeyFactorySpi", "SecretKeySpec",
"SecureCacheResponse", "SecureClassLoader", "SecureProcessing", "SecureRandom",
"SecureRandomSpi", "Security", "SecurityException", "SecurityManager",
"SecurityPermission", "Segment", "SelectableChannel", "SelectionKey",
"Selector", "SelectorProvider", "Semaphore", "SeparatorUI", "Sequence",
"SequenceInputStream", "Sequencer", "Sequencer.SyncMode", "SerialArray",
"SerialBlob", "SerialClob", "SerialDatalink", "SerialException",
"SerialJavaObject", "SerialRef", "SerialStruct", "Serializable",
"SerializablePermission", "Servant", "ServantActivator",
"ServantActivatorHelper", "ServantActivatorOperations", "ServantActivatorPOA",
"ServantAlreadyActive", "ServantAlreadyActiveHelper", "ServantLocator",
"ServantLocatorHelper", "ServantLocatorOperations", "ServantLocatorPOA",
"ServantManager", "ServantManagerOperations", "ServantNotActive",
"ServantNotActiveHelper", "ServantObject", "ServantRetentionPolicy",
"ServantRetentionPolicyOperations", "ServantRetentionPolicyValue",
"ServerCloneException", "ServerError", "ServerException", "ServerIdHelper",
"ServerNotActiveException", "ServerRef", "ServerRequest", "ServerRequestInfo",
"ServerRequestInfoOperations", "ServerRequestInterceptor",
"ServerRequestInterceptorOperations", "ServerRuntimeException", "ServerSocket",
"ServerSocketChannel", "ServerSocketFactory", "ServiceContext",
"ServiceContextHelper", "ServiceContextHolder", "ServiceContextListHelper",
"ServiceContextListHolder", "ServiceDetail", "ServiceDetailHelper",
"ServiceIdHelper", "ServiceInformation", "ServiceInformationHelper",
"ServiceInformationHolder", "ServiceNotFoundException", "ServicePermission",
"ServiceRegistry", "ServiceRegistry.Filter", "ServiceUI", "ServiceUIFactory",
"ServiceUnavailableException", "Set", "SetOfIntegerSyntax", "SetOverrideType",
"SetOverrideTypeHelper", "Severity", "Shape", "ShapeGraphicAttribute",
"SheetCollate", "Short", "ShortBuffer", "ShortBufferException", "ShortHolder",
"ShortLookupTable", "ShortMessage", "ShortSeqHelper", "ShortSeqHolder", "Sides",
"Signature", "SignatureException", "SignatureSpi", "SignedObject", "Signer",
"SimpleAttributeSet", "SimpleBeanInfo", "SimpleDateFormat", "SimpleDoc",
"SimpleFormatter", "SimpleTimeZone", "SimpleType",
"SinglePixelPackedSampleModel", "SingleSelectionModel", "Size2DSyntax",
"SizeLimitExceededException", "SizeRequirements", "SizeSequence", "Skeleton",
"SkeletonMismatchException", "SkeletonNotFoundException", "SliderUI", "Socket",
"SocketAddress", "SocketChannel", "SocketException", "SocketFactory",
"SocketHandler", "SocketImpl", "SocketImplFactory", "SocketOptions",
"SocketPermission", "SocketSecurityException", "SocketTimeoutException",
"SoftBevelBorder", "SoftReference", "SortControl", "SortKey",
"SortResponseControl", "SortedMap", "SortedSet", "SortingFocusTraversalPolicy",
"Soundbank", "SoundbankReader", "SoundbankResource", "Source", "SourceDataLine",
"SourceLocator", "SpinnerDateModel", "SpinnerListModel", "SpinnerModel",
"SpinnerNumberModel", "SpinnerUI", "SplitPaneUI", "Spring", "SpringLayout",
"SpringLayout.Constraints", "Stack", "StackOverflowError", "StackTraceElement",
"StandardMBean", "StartTlsRequest", "StartTlsResponse", "State", "StateEdit",
"StateEditable", "StateFactory", "Statement", "Statement",
"StreamCorruptedException", "StreamHandler", "StreamPrintService",
"StreamPrintServiceFactory", "StreamResult", "StreamSource", "StreamTokenizer",
"Streamable", "StreamableValue", "StrictMath", "String", "StringBuffer",
"StringBufferInputStream", "StringBuilder", "StringCharacterIterator",
"StringContent", "StringHolder", "StringIndexOutOfBoundsException",
"StringMonitor", "StringMonitorMBean", "StringNameHelper", "StringReader",
"StringRefAddr", "StringSelection", "StringSeqHelper", "StringSeqHolder",
"StringTokenizer", "StringValueExp", "StringValueHelper", "StringWriter",
"Stroke", "Struct", "StructMember", "StructMemberHelper", "Stub",
"StubDelegate", "StubNotFoundException", "Style", "StyleConstants",
"StyleContext", "StyleSheet", "StyleSheet.BoxPainter", "StyleSheet.ListPainter",
"StyledDocument", "StyledEditorKit", "Subject", "SubjectDelegationPermission",
"SubjectDomainCombiner", "SupportedValuesAttribute", "SwingConstants",
"SwingPropertyChangeSupport", "SwingUtilities", "SyncFactory",
"SyncFactoryException", "SyncFailedException", "SyncProvider",
"SyncProviderException", "SyncResolver", "SyncScopeHelper", "SynchronousQueue",
"SynthConstants", "SynthContext", "SynthGraphicsUtils", "SynthLookAndFeel",
"SynthPainter", "SynthStyle", "SynthStyleFactory", "Synthesizer",
"SysexMessage", "System", "SystemColor", "SystemException", "SystemFlavorMap",
"TAG_ALTERNATE_IIOP_ADDRESS", "TAG_CODE_SETS", "TAG_INTERNET_IOP",
"TAG_JAVA_CODEBASE", "TAG_MULTIPLE_COMPONENTS", "TAG_ORB_TYPE", "TAG_POLICIES",
"TAG_RMI_CUSTOM_MAX_STREAM_FORMAT", "TCKind", "THREAD_POLICY_ID",
"TRANSACTION_REQUIRED", "TRANSACTION_ROLLEDBACK", "TRANSIENT",
"TRANSPORT_RETRY", "TabExpander", "TabSet", "TabStop", "TabableView",
"TabbedPaneUI", "TableCellEditor", "TableCellRenderer", "TableColumn",
"TableColumnModel", "TableColumnModelEvent", "TableColumnModelListener",
"TableHeaderUI", "TableModel", "TableModelEvent", "TableModelListener",
"TableUI", "TableView", "TabularData", "TabularDataSupport", "TabularType",
"TagElement", "TaggedComponent", "TaggedComponentHelper",
"TaggedComponentHolder", "TaggedProfile", "TaggedProfileHelper",
"TaggedProfileHolder", "Target", "TargetDataLine", "TargetedNotification",
"Templates", "TemplatesHandler", "Text", "TextAction", "TextArea",
"TextAttribute", "TextComponent", "TextEvent", "TextField", "TextHitInfo",
"TextInputCallback", "TextLayout", "TextLayout.CaretPolicy", "TextListener",
"TextMeasurer", "TextOutputCallback", "TextSyntax", "TextUI", "TexturePaint",
"Thread", "Thread.UncaughtExceptionHandler", "ThreadDeath", "ThreadFactory",
"ThreadGroup", "ThreadInfo", "ThreadLocal", "ThreadMBean", "ThreadPolicy",
"ThreadPolicyOperations", "ThreadPolicyValue", "ThreadPoolExecutor",
"ThreadPoolExecutor.AbortPolicy", "ThreadPoolExecutor.CallerRunsPolicy",
"ThreadPoolExecutor.DiscardOldestPolicy", "ThreadPoolExecutor.DiscardPolicy",
"ThreadState", "Throwable", "Tie", "TileObserver", "Time",
"TimeLimitExceededException", "TimeUnit", "TimeZone", "TimeoutException",
"Timer", "Timer", "Timer", "TimerAlarmClockNotification", "TimerMBean",
"TimerNotification", "TimerTask", "Timestamp", "Timestamp", "TitledBorder",
"TooManyListenersException", "ToolBarUI", "ToolTipManager", "ToolTipUI",
"Toolkit", "Track", "TransactionRequiredException",
"TransactionRolledbackException", "TransactionService", "TransactionalWriter",
"TransferHandler", "Transferable", "TransformAttribute", "Transformer",
"TransformerConfigurationException", "TransformerException",
"TransformerFactory", "TransformerFactoryConfigurationError",
"TransformerHandler", "Transmitter", "Transparency", "TreeCellEditor",
"TreeCellRenderer", "TreeExpansionEvent", "TreeExpansionListener", "TreeMap",
"TreeModel", "TreeModelEvent", "TreeModelListener", "TreeNode", "TreePath",
"TreeSelectionEvent", "TreeSelectionListener", "TreeSelectionModel", "TreeSet",
"TreeUI", "TreeWillExpandListener", "TrustAnchor", "TrustManager",
"TrustManagerFactory", "TrustManagerFactorySpi", "Type", "TypeCode",
"TypeCodeHolder", "TypeInfo", "TypeInfoProvider", "TypeMismatch",
"TypeMismatch", "TypeMismatch", "TypeMismatchHelper", "TypeMismatchHelper",
"TypeNotPresentException", "TypeVariable", "Types", "UID", "UIDefaults",
"UIDefaults.ActiveValue", "UIDefaults.LazyInputMap", "UIDefaults.LazyValue",
"UIDefaults.ProxyLazyValue", "UIManager", "UIManager.LookAndFeelInfo",
"UIResource", "ULongLongSeqHelper", "ULongLongSeqHolder", "ULongSeqHelper",
"ULongSeqHolder", "UNKNOWN", "UNKNOWN", "UNSUPPORTED_POLICY",
"UNSUPPORTED_POLICY_VALUE", "URI", "URIException", "URIResolver", "URISyntax",
"URISyntaxException", "URL", "URLClassLoader", "URLConnection", "URLDecoder",
"URLEncoder", "URLStreamHandler", "URLStreamHandlerFactory", "URLStringHelper",
"USER_EXCEPTION", "UShortSeqHelper", "UShortSeqHolder",
"UTFDataFormatException", "UUID", "UndeclaredThrowableException", "UndoManager",
"UndoableEdit", "UndoableEditEvent", "UndoableEditListener",
"UndoableEditSupport", "UnexpectedException", "UnicastRemoteObject",
"UnionMember", "UnionMemberHelper", "UnknownEncoding", "UnknownEncodingHelper",
"UnknownError", "UnknownException", "UnknownFormatConversionException",
"UnknownFormatFlagsException", "UnknownGroupException", "UnknownHostException",
"UnknownHostException", "UnknownObjectException", "UnknownServiceException",
"UnknownUserException", "UnknownUserExceptionHelper",
"UnknownUserExceptionHolder", "UnmappableCharacterException",
"UnmarshalException", "UnmodifiableSetException", "UnrecoverableEntryException",
"UnrecoverableKeyException", "Unreferenced", "UnresolvedAddressException",
"UnresolvedPermission", "UnsatisfiedLinkError", "UnsolicitedNotification",
"UnsolicitedNotificationEvent", "UnsolicitedNotificationListener",
"UnsupportedAddressTypeException", "UnsupportedAudioFileException",
"UnsupportedCallbackException", "UnsupportedCharsetException",
"UnsupportedClassVersionError", "UnsupportedEncodingException",
"UnsupportedFlavorException", "UnsupportedLookAndFeelException",
"UnsupportedOperationException", "UserDataHandler", "UserException", "Util",
"UtilDelegate", "Utilities", "VMID", "VM_ABSTRACT", "VM_CUSTOM", "VM_NONE",
"VM_TRUNCATABLE", "Validator", "ValidatorHandler", "ValueBase",
"ValueBaseHelper", "ValueBaseHolder", "ValueExp", "ValueFactory",
"ValueHandler", "ValueHandlerMultiFormat", "ValueInputStream", "ValueMember",
"ValueMemberHelper", "ValueOutputStream", "VariableHeightLayoutCache", "Vector",
"VerifyError", "Version", "VersionImpl", "VersionSpecHelper",
"VetoableChangeListener", "VetoableChangeListenerProxy",
"VetoableChangeSupport", "View", "ViewFactory", "ViewportLayout", "ViewportUI",
"VirtualMachineError", "Visibility", "VisibilityHelper", "VoiceStatus", "Void",
"VolatileImage", "WCharSeqHelper", "WCharSeqHolder", "WStringSeqHelper",
"WStringSeqHolder", "WStringValueHelper", "WeakHashMap", "WeakReference",
"WebRowSet", "WildcardType", "Window", "WindowAdapter", "WindowConstants",
"WindowEvent", "WindowFocusListener", "WindowListener", "WindowStateListener",
"WrappedPlainView", "WritableByteChannel", "WritableRaster",
"WritableRenderedImage", "WriteAbortedException", "Writer", "WrongAdapter",
"WrongAdapterHelper", "WrongPolicy", "WrongPolicyHelper", "WrongTransaction",
"WrongTransactionHelper", "WrongTransactionHolder", "X500Principal",
"X500PrivateCredential", "X509CRL", "X509CRLEntry", "X509CRLSelector",
"X509CertSelector", "X509Certificate", "X509Certificate", "X509EncodedKeySpec",
"X509Extension", "X509KeyManager", "X509TrustManager", "XAConnection",
"XADataSource", "XAException", "XAResource", "XMLConstants", "XMLDecoder",
"XMLEncoder", "XMLFilter", "XMLFilterImpl", "XMLFormatter",
"XMLGregorianCalendar", "XMLParseException", "XMLReader", "XMLReaderAdapter",
"XMLReaderFactory", "XMLUtils", "XPath", "XPathConstants", "XPathException",
"XPathExpression", "XPathExpressionException", "XPathFactory",
"XPathFactoryConfigurationException", "XPathFunction", "XPathFunctionException",
"XPathFunctionResolver", "XPathVariableResolver", "Xid", "XmlReader",
"XmlWriter", "ZipEntry", "ZipException", "ZipFile", "ZipInputStream",
"ZipOutputStream", "ZoneView" }
} )
end
end
--The Plugins array assigns code chunks to themes or language definitions.
--The chunks are interpreted after the theme or lang file were parsed,
--so you can refer to elements of these files
Plugins={
{ Type="lang", Chunk=syntaxUpdate },
}
| gpl-3.0 |
mercury233/ygopro-scripts | c80230510.lua | 2 | 2172 | --埋葬されし生け贄
function c80230510.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c80230510.target)
e1:SetOperation(c80230510.activate)
c:RegisterEffect(e1)
end
function c80230510.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,80230510)==0 end
end
function c80230510.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(80230510,0))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetTargetRange(LOCATION_HAND,0)
e1:SetCondition(c80230510.otcon)
e1:SetTarget(c80230510.ottg)
e1:SetOperation(c80230510.otop)
e1:SetCountLimit(1)
e1:SetValue(SUMMON_TYPE_ADVANCE)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_PROC)
Duel.RegisterEffect(e2,tp)
Duel.RegisterFlagEffect(tp,80230510,RESET_PHASE+PHASE_END,0,1)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e3:SetReset(RESET_PHASE+PHASE_END)
e3:SetTargetRange(1,0)
Duel.RegisterEffect(e3,tp)
end
function c80230510.rmfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c80230510.otcon(e,c,minc)
if c==nil then return true end
local tp=c:GetControler()
return minc<=2 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c80230510.rmfilter,tp,LOCATION_GRAVE,0,1,nil)
and Duel.IsExistingMatchingCard(c80230510.rmfilter,tp,0,LOCATION_GRAVE,1,nil)
end
function c80230510.ottg(e,c)
local mi,ma=c:GetTributeRequirement()
return mi<=2 and ma>=2
end
function c80230510.otop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=Duel.SelectMatchingCard(tp,c80230510.rmfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=Duel.SelectMatchingCard(tp,c80230510.rmfilter,tp,0,LOCATION_GRAVE,1,1,nil)
g1:Merge(g2)
Duel.Remove(g1,POS_FACEUP,REASON_COST)
Duel.ResetFlagEffect(tp,80230510)
c:SetMaterial(nil)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c4068622.lua | 2 | 4126 | --BF-極光のアウロラ
function c4068622.initial_effect(c)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c4068622.spcon)
e1:SetTarget(c4068622.sptg)
e1:SetOperation(c4068622.spop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(4068622,0))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetTarget(c4068622.target)
e2:SetOperation(c4068622.operation)
c:RegisterEffect(e2)
--special summon limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_SPSUMMON_CONDITION)
e3:SetValue(aux.FALSE)
c:RegisterEffect(e3)
end
function c4068622.spfilter(c)
return c:IsFaceup() and c:IsAbleToRemoveAsCost()
end
function c4068622.spfilter1(c)
return c:IsSetCard(0x33) and c:IsType(TYPE_TUNER)
end
function c4068622.spfilter2(c)
return not c:IsType(TYPE_TUNER)
end
function c4068622.fselect(g,tp)
return aux.mzctcheck(g,tp) and aux.gffcheck(g,c4068622.spfilter1,nil,c4068622.spfilter2,nil)
end
function c4068622.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(c4068622.spfilter,tp,LOCATION_MZONE,0,nil)
return g:CheckSubGroup(c4068622.fselect,2,2,tp)
end
function c4068622.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
local g=Duel.GetMatchingGroup(c4068622.spfilter,tp,LOCATION_MZONE,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local sg=g:SelectSubGroup(tp,c4068622.fselect,true,2,2,tp)
if sg then
sg:KeepAlive()
e:SetLabelObject(sg)
return true
else return false end
end
function c4068622.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=e:GetLabelObject()
Duel.Remove(g,POS_FACEUP,REASON_COST)
g:DeleteGroup()
end
function c4068622.filter(c)
return c:IsSetCard(0x33) and c:IsAbleToRemove()
end
function c4068622.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c4068622.filter,tp,LOCATION_EXTRA,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_EXTRA)
end
function c4068622.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c4068622.filter,tp,LOCATION_EXTRA,0,1,1,nil)
local tc=g:GetFirst()
local c=e:GetHandler()
if tc and c:IsFaceup() and c:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)>0 then
--copy name, base atk
local code=tc:GetOriginalCode()
local ba=tc:GetBaseAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetValue(code)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e2:SetLabelObject(e1)
e2:SetCode(EFFECT_SET_BASE_ATTACK_FINAL)
e2:SetValue(ba)
c:RegisterEffect(e2)
--copy effect
local cid=c:CopyEffect(code,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,1)
local e3=Effect.CreateEffect(c)
e3:SetDescription(1162)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCountLimit(1)
e3:SetRange(LOCATION_MZONE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e3:SetLabel(cid)
e3:SetLabelObject(e2)
e3:SetOperation(c4068622.rstop)
c:RegisterEffect(e3)
end
end
function c4068622.rstop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local cid=e:GetLabel()
c:ResetEffect(cid,RESET_COPY)
c:ResetEffect(RESET_DISABLE,RESET_EVENT)
local e2=e:GetLabelObject()
local e1=e2:GetLabelObject()
e1:Reset()
e2:Reset()
Duel.HintSelection(Group.FromCards(c))
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
| gpl-2.0 |
mercury233/ygopro-scripts | c48179391.lua | 2 | 2475 | --オレイカルコスの結界
function c48179391.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCountLimit(1,48179391+EFFECT_COUNT_CODE_DUEL+EFFECT_COUNT_CODE_OATH)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c48179391.acttg)
e1:SetOperation(c48179391.actop)
c:RegisterEffect(e1)
--spsummon limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_FZONE)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetTarget(c48179391.sumlimit)
c:RegisterEffect(e2)
--
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetRange(LOCATION_FZONE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetValue(500)
c:RegisterEffect(e3)
--
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_FZONE)
e4:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
e4:SetCountLimit(1)
e4:SetValue(c48179391.valcon)
c:RegisterEffect(e4)
--atk limit
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e5:SetRange(LOCATION_FZONE)
e5:SetTargetRange(0,LOCATION_MZONE)
e5:SetCondition(c48179391.atkcon)
e5:SetValue(c48179391.atlimit)
c:RegisterEffect(e5)
end
function c48179391.desfilter(c)
return c:IsSummonType(SUMMON_TYPE_SPECIAL)
end
function c48179391.acttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(c48179391.desfilter,tp,LOCATION_MZONE,0,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c48179391.actop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c48179391.desfilter,tp,LOCATION_MZONE,0,nil)
if g:GetCount()>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
function c48179391.sumlimit(e,c,sump,sumtype,sumpos,targetp)
return c:IsLocation(LOCATION_EXTRA)
end
function c48179391.valcon(e,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0
end
function c48179391.atkcon(e)
return Duel.IsExistingMatchingCard(Card.IsPosition,e:GetHandlerPlayer(),LOCATION_MZONE,0,2,nil,POS_FACEUP_ATTACK)
end
function c48179391.atkfilter(c,atk)
return c:IsFaceup() and c:GetAttack()<atk
end
function c48179391.atlimit(e,c)
return c:IsFaceup() and not Duel.IsExistingMatchingCard(c48179391.atkfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,c,c:GetAttack())
end
| gpl-2.0 |
AleppoTeam/Aleppo | plugins/lock_media.lua | 11 | 1481 | --[[
#
#ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
#:((
# For More Information ....!
# Developer : Aziz < @TH3_GHOST >
# our channel: @DevPointTeam
# Version: 1.1
#:))
#ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
#
]]
local function DevPoint(msg, matches)
if is_momod(msg) then
return
end
local data = load_data(_config.moderation.data)
if data[tostring(msg.to.id)] then
if data[tostring(msg.to.id)]['settings'] then
if data[tostring(msg.to.id)]['settings']['media'] then
lock_media = data[tostring(msg.to.id)]['settings']['media']
end
end
end
local chat = get_receiver(msg)
local user = "user#id"..msg.from.id
if lock_media == "yes" then
delete_msg(msg.id, ok_cb, true)
send_large_msg(get_receiver(msg), 'عزيزي " '..msg.from.first_name..' "\nممنوع مشاركة " الصور - الروابط - الاعلانات - المواقع " هنا التزم بقوانين المجموعة 👮\n#Username : @'..msg.from.username)
end
end
return {
patterns = {
"%[(photo)%]",
"%[(document)%]",
"%[(video)%]",
"%[(audio)%]",
"%[(gif)%]",
"%[(sticker)%]",
},
run = DevPoint
}
| gpl-2.0 |
mercury233/ygopro-scripts | c55285840.lua | 2 | 3807 | --クロノダイバー・リダン
function c55285840.initial_effect(c)
c:EnableReviveLimit()
aux.AddXyzProcedure(c,nil,4,2)
--attach
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(55285840,0))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(c55285840.mattg)
e1:SetOperation(c55285840.matop)
c:RegisterEffect(e1)
--activate
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(55285840,1))
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e2:SetCountLimit(1,55285840)
e2:SetTarget(c55285840.target)
e2:SetOperation(c55285840.operation)
c:RegisterEffect(e2)
end
function c55285840.mattg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsType(TYPE_XYZ) and Duel.GetFieldGroupCount(1-tp,LOCATION_DECK,0)>0 end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function c55285840.matop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetDecktopGroup(1-tp,1)
if c:IsRelateToEffect(e) and g:GetCount()==1 then
Duel.DisableShuffleCheck()
Duel.Overlay(c,g)
end
end
function c55285840.tgfilter(c)
return c:IsFaceup() and c:IsAbleToDeck()
end
function c55285840.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local c=e:GetHandler()
if not c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT) then return false end
local g=c:GetOverlayGroup()
if g:IsExists(Card.IsType,1,nil,TYPE_MONSTER)
and c:IsAbleToRemove() then return true end
if g:IsExists(Card.IsType,1,nil,TYPE_SPELL)
and Duel.IsPlayerCanDraw(tp,1) then return true end
if g:IsExists(Card.IsType,1,nil,TYPE_TRAP)
and Duel.IsExistingMatchingCard(c55285840.tgfilter,tp,0,LOCATION_ONFIELD,1,nil) then return true end
return false
end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function c55285840.check(g)
return g:FilterCount(Card.IsType,nil,TYPE_MONSTER)<=1
and g:FilterCount(Card.IsType,nil,TYPE_SPELL)<=1
and g:FilterCount(Card.IsType,nil,TYPE_TRAP)<=1
end
function c55285840.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or not c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT) then return end
local g=c:GetOverlayGroup()
local tg=Group.CreateGroup()
if c:IsAbleToRemove() then
tg:Merge(g:Filter(Card.IsType,nil,TYPE_MONSTER))
end
if Duel.IsPlayerCanDraw(tp,1) then
tg:Merge(g:Filter(Card.IsType,nil,TYPE_SPELL))
end
if Duel.IsExistingMatchingCard(c55285840.tgfilter,tp,0,LOCATION_ONFIELD,1,nil) then
tg:Merge(g:Filter(Card.IsType,nil,TYPE_TRAP))
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVEXYZ)
local sg=tg:SelectSubGroup(tp,c55285840.check,false,1,3)
if not sg then return end
Duel.SendtoGrave(sg,REASON_EFFECT)
Duel.RaiseSingleEvent(c,EVENT_DETACH_MATERIAL,e,0,0,0,0)
if sg:IsExists(Card.IsType,1,nil,TYPE_MONSTER) then
Duel.BreakEffect()
Duel.Remove(c,0,REASON_EFFECT+REASON_TEMPORARY)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetLabelObject(c)
e1:SetCountLimit(1)
e1:SetOperation(c55285840.retop)
Duel.RegisterEffect(e1,tp)
end
if sg:IsExists(Card.IsType,1,nil,TYPE_SPELL) then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
if sg:IsExists(Card.IsType,1,nil,TYPE_TRAP) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local dg=Duel.SelectMatchingCard(tp,c55285840.tgfilter,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SendtoDeck(dg,nil,SEQ_DECKTOP,REASON_EFFECT)
end
end
function c55285840.retop(e,tp,eg,ep,ev,re,r,rp)
Duel.ReturnToField(e:GetLabelObject())
end
| gpl-2.0 |
mercury233/ygopro-scripts | c21576077.lua | 2 | 2359 | --喰光の竜輝巧
function c21576077.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(21576077,0))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,21576077)
e1:SetTarget(c21576077.target)
e1:SetOperation(c21576077.activate)
c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(21576077,1))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,21576078)
e2:SetCondition(aux.exccon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c21576077.atktg)
e2:SetOperation(c21576077.atkop)
c:RegisterEffect(e2)
end
function c21576077.filter(c)
return c:IsSetCard(0x154) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c21576077.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c21576077.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c21576077.filter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c21576077.filter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c21576077.activate(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
function c21576077.atkfilter(c)
return c:IsFaceup() and c:IsSetCard(0x154)
end
function c21576077.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c21576077.atkfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c21576077.atkfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c21576077.atkfilter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c21576077.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_UPDATE_ATTACK)
e1:SetValue(2000)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END+RESET_OPPO_TURN)
tc:RegisterEffect(e1)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c21200905.lua | 4 | 3141 | --アロマセラフィ-ジャスミン
function c21200905.initial_effect(c)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_PLANT),2,2)
--indes
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetCondition(c21200905.indcon)
e1:SetTarget(c21200905.indtg)
e1:SetValue(1)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(21200905,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,21200905)
e2:SetCost(c21200905.spcost)
e2:SetTarget(c21200905.sptg)
e2:SetOperation(c21200905.spop)
c:RegisterEffect(e2)
--search
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(21200905,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_RECOVER)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(c21200905.thcon)
e3:SetTarget(c21200905.thtg)
e3:SetOperation(c21200905.thop)
c:RegisterEffect(e3)
end
function c21200905.indcon(e)
local tp=e:GetHandlerPlayer()
return Duel.GetLP(tp)>Duel.GetLP(1-tp)
end
function c21200905.indtg(e,c)
return e:GetHandler()==c or (c:IsRace(RACE_PLANT) and e:GetHandler():GetLinkedGroup():IsContains(c))
end
function c21200905.cfilter(c,g)
return g:IsContains(c)
end
function c21200905.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local lg=e:GetHandler():GetLinkedGroup()
if chk==0 then return Duel.CheckReleaseGroup(tp,c21200905.cfilter,1,nil,lg) end
local g=Duel.SelectReleaseGroup(tp,c21200905.cfilter,1,1,nil,lg)
Duel.Release(g,REASON_COST)
end
function c21200905.spfilter(c,e,tp)
return c:IsRace(RACE_PLANT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c21200905.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c21200905.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c21200905.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,c21200905.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
end
function c21200905.thcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp
end
function c21200905.thfilter(c)
return c:IsRace(RACE_PLANT) and c:IsAbleToHand()
end
function c21200905.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c21200905.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c21200905.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 |
Zenny89/darkstar | scripts/globals/spells/armys_paeon_ii.lua | 31 | 1390 | -----------------------------------------
-- Spell: Army's Paeon II
-- Gradually restores target's HP.
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
function onSpellCast(caster,target,spell)
local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing
local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED);
local power = 2;
if (sLvl+iLvl > 150) then
power = power + 1;
end
local iBoost = caster:getMod(MOD_PAEON_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT);
power = power + iBoost;
if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then
power = power * 2;
elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then
power = power * 1.5;
end
caster:delStatusEffect(EFFECT_MARCATO);
local duration = 120;
duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1);
if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then
duration = duration * 2;
end
if not (target:addBardSong(caster,EFFECT_PAEON,power,0,duration,caster:getID(), 0, 2)) then
spell:setMsg(75);
end
return EFFECT_PAEON;
end; | gpl-3.0 |
mercury233/ygopro-scripts | c14152693.lua | 2 | 3152 | --月光翠鳥
function c14152693.initial_effect(c)
--draw
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(14152693,0))
e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1,14152693)
e1:SetTarget(c14152693.drtg)
e1:SetOperation(c14152693.drop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(14152693,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCountLimit(1,14152694)
e3:SetCondition(c14152693.spcon)
e3:SetTarget(c14152693.sptg)
e3:SetOperation(c14152693.spop)
c:RegisterEffect(e3)
end
function c14152693.tgfilter(c)
return c:IsSetCard(0xdf) and c:IsAbleToGrave()
end
function c14152693.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1)
and Duel.IsExistingMatchingCard(c14152693.tgfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c14152693.drop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c14152693.tgfilter,tp,LOCATION_HAND,0,1,1,nil)
if g:GetCount()>0 and Duel.SendtoGrave(g,REASON_EFFECT)~=0 and g:GetFirst():IsLocation(LOCATION_GRAVE) then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function c14152693.spfilter(c,e,tp)
return (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and c:IsLevelBelow(4) and c:IsSetCard(0xdf) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) and not c:IsCode(14152693)
end
function c14152693.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_EFFECT)
end
function c14152693.sptg(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 c14152693.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c14152693.spfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c14152693.spfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c14152693.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
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+RESETS_STANDARD)
tc:RegisterEffect(e2)
end
Duel.SpecialSummonComplete()
end
| gpl-2.0 |
mercury233/ygopro-scripts | c73694478.lua | 4 | 3113 | --転生の超戦士
function c73694478.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:SetHintTiming(0,TIMING_END_PHASE)
e1:SetCountLimit(1,73694478+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c73694478.target)
e1:SetOperation(c73694478.activate)
c:RegisterEffect(e1)
--tohand
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_GRAVE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCondition(c73694478.thcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c73694478.thtg)
e2:SetOperation(c73694478.thop)
c:RegisterEffect(e2)
end
function c73694478.filter(c,e,tp,ft)
return c:IsFaceup() and c:IsSetCard(0x10cf) and (ft>0 or c:GetSequence()<5)
and Duel.IsExistingMatchingCard(c73694478.spfilter,tp,LOCATION_HAND,0,1,nil,c:GetCode(),e,tp)
end
function c73694478.spfilter(c,code,e,tp)
return c:IsSetCard(0x10cf) and not c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function c73694478.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c73694478.filter(chkc,e,tp,ft) end
if chk==0 then return ft>-1 and Duel.IsExistingTarget(c73694478.filter,tp,LOCATION_MZONE,0,1,nil,e,tp,ft) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectTarget(tp,c73694478.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp,ft)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c73694478.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
local code=tc:GetCode()
if Duel.SendtoGrave(tc,REASON_EFFECT)==0 or not tc:IsLocation(LOCATION_GRAVE) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c73694478.spfilter,tp,LOCATION_HAND,0,1,1,nil,code,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP)
end
end
function c73694478.thcon(e,tp,eg,ep,ev,re,r,rp)
return aux.exccon(e) and Duel.GetTurnPlayer()==tp and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function c73694478.thfilter(c)
return c:IsSetCard(0x10cf) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c73694478.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c73694478.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c73694478.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c73694478.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c73694478.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 |
mercury233/ygopro-scripts | c51773900.lua | 9 | 1112 | --カーム・マジック
function c51773900.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c51773900.condition)
e1:SetOperation(c51773900.operation)
c:RegisterEffect(e1)
end
function c51773900.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 and not Duel.CheckPhaseActivity()
end
function c51773900.operation(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetCondition(c51773900.sumcon)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,1)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp)
local e3=e1:Clone()
e3:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
Duel.RegisterEffect(e3,tp)
local e4=e1:Clone()
e4:SetCode(EFFECT_CANNOT_MSET)
Duel.RegisterEffect(e4,tp)
end
function c51773900.sumcon(e)
local ph=Duel.GetCurrentPhase()
return ph>=PHASE_MAIN1 and ph<=PHASE_MAIN2
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Port_San_dOria/npcs/Patolle.lua | 36 | 1790 | -----------------------------------
-- Area: Port San d'Oria
-- NPC: Patolle
-- Only sells when San d'Oria controlls Kuzotz Region
-- Working 100%
-----------------------------------
package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/shop");
require("scripts/globals/conquest");
require("scripts/globals/quests");
require("scripts/zones/Port_San_dOria/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
-- "Flyers for Regine" conditional script
FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE);
if (FlyerForRegine == 1) then
count = trade:getItemCount();
MagicFlyer = trade:hasItemQty(532,1);
if (MagicFlyer == true and count == 1) then
player:messageSpecial(FLYER_REFUSED);
end
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
RegionOwner = GetRegionOwner(KUZOTZ);
if (RegionOwner ~= SANDORIA) then
player:showText(npc,PATOLLE_CLOSED_DIALOG);
else
player:showText(npc,PATOLLE_OPEN_DIALOG);
stock = {0x0394,855, --Cactuar Needle
0x113c,299, --Thundermelon
0x118b,184} --Watermelon
showShop(player,SANDORIA,stock);
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 |
mercury233/ygopro-scripts | c99243014.lua | 2 | 2716 | --シンクロ・オーバーテイク
function c99243014.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,99243014+EFFECT_COUNT_CODE_OATH)
e1:SetCost(c99243014.cost)
e1:SetTarget(c99243014.target)
e1:SetOperation(c99243014.activate)
c:RegisterEffect(e1)
Duel.AddCustomActivityCounter(99243014,ACTIVITY_SPSUMMON,c99243014.counterfilter)
end
function c99243014.counterfilter(c)
return not c:IsSummonLocation(LOCATION_EXTRA) or c:IsType(TYPE_SYNCHRO)
end
function c99243014.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(99243014,tp,ACTIVITY_SPSUMMON)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
e1:SetTarget(c99243014.splimit)
Duel.RegisterEffect(e1,tp)
end
function c99243014.splimit(e,c)
return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_SYNCHRO)
end
function c99243014.ffilter(c,e,tp,ft)
return c:IsType(TYPE_SYNCHRO) and Duel.IsExistingMatchingCard(c99243014.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,c,e,tp,ft)
end
function c99243014.spfilter(c,fc,e,tp,ft)
return aux.IsMaterialListCode(fc,c:GetCode()) and (c:IsAbleToHand() or ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false))
end
function c99243014.target(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if chk==0 then return Duel.IsExistingMatchingCard(c99243014.ffilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,ft) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c99243014.activate(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local tc=Duel.SelectMatchingCard(tp,c99243014.ffilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,ft):GetFirst()
if tc then
Duel.ConfirmCards(1-tp,tc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c99243014.spfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tc,e,tp,ft)
local cc=g:GetFirst()
if cc then
if cc:IsAbleToHand() and (not cc:IsCanBeSpecialSummoned(e,0,tp,false,false) or ft<=0 or Duel.SelectOption(tp,1190,1152)==0) then
Duel.SendtoHand(cc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,cc)
else
Duel.SpecialSummon(cc,0,tp,tp,false,false,POS_FACEUP)
end
end
end
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/The_Eldieme_Necropolis/TextIDs.lua | 7 | 2300 | -- Variable TextID Description text
-- General Texts
ITEM_CANNOT_BE_OBTAINED = 6538; -- You cannot obtain the item <item> come back again after sorting your inventory
ITEM_OBTAINED = 6542; -- Obtained: <item>
GIL_OBTAINED = 6543; -- Obtained <number> gil
KEYITEM_OBTAINED = 6545; -- Obtained key item: <keyitem>
SOLID_STONE = 7365; -- This door is made of solid stone.
-- Treasure Coffer/Chest Dialog
CHEST_UNLOCKED = 7384; -- You unlock the chest!
CHEST_FAIL = 7385; -- Fails to open the chest.
CHEST_TRAP = 7386; -- The chest was trapped!
CHEST_WEAK = 7387; -- You cannot open the chest when you are in a weakened state.
CHEST_MIMIC = 7388; -- The chest was a mimic!
CHEST_MOOGLE = 7389; -- You cannot open the chest while participating in the moogle event.
CHEST_ILLUSION = 7390; -- The chest was but an illusion...
CHEST_LOCKED = 7391; -- The chest appears to be locked.
-- Quests
NOTHING_OUT_OF_ORDINARY = 6556; -- There is nothing out of the ordinary here.
SENSE_OF_FOREBODING = 6557; -- You are suddenly overcome with a sense of foreboding...
NOTHING_HAPPENED = 7325; -- Nothing happened...
RETURN_RIBBON_TO_HER = 7338; -- You can hear a voice from somewhere. (...return...ribbon to...her...)
THE_BRAZIER_IS_LIT = 7352; -- The brazier is lit.
REFUSE_TO_LIGHT = 7353; -- Unexpectedly, therefuses to light.
LANTERN_GOES_OUT = 7354; -- For some strange reason, the light of thegoes out...
THE_LIGHT_DIMLY = 7355; -- lights dimly. It doesn't look like this will be effective yet.?Prompt?
THE_LIGHT_HAS_INTENSIFIED = 7356; -- The light of thehas intensified.
THE_LIGHT_IS_FULLY_LIT = 7357; -- is fully lit!
SPIRIT_INCENSE_EMITS_PUTRID_ODOR = 7394; -- emits a putrid odor and burns up. Your attempt this time has failed...?Prompt?
SARCOPHAGUS_CANNOT_BE_OPENED = 7411; -- It is a stone sarcophagus with the lid sealed tight. It cannot be opened.
-- conquest Base
CONQUEST_BASE = 0;
-- Strange Apparatus
DEVICE_NOT_WORKING = 7301; -- The device is not working.
SYS_OVERLOAD = 7310; -- arning! Sys...verload! Enterin...fety mode. ID eras...d
YOU_LOST_THE = 7315; -- You lost the #.
| gpl-3.0 |
rouing/FHLG-BW | entities/entities/shot_explodingbar/init.lua | 1 | 1863 | /* ======================================
EXPLODING CROWBAR
====================================== */
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 20
local ent = ents.Create( "bigbomb" )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent
end
/*---------------------------------------------------------
Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()
self.Entity:SetModel("models/weapons/w_crowbar.mdl")
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
self.DidHit=false
end
function ENT:Think()
if (IsValid(self.Entity:GetOwner())==false) then
self.Entity:Remove()
end
end
function ENT:HitShit()
self.Entity:GetPhysicsObject():Wake()
self.DidHit = true
end
function ENT:Explode()
util.BlastDamage( self.Entity, self.Entity:GetOwner(), self.Entity:GetPos(), 384, 250 )
local effectdata = EffectData()
effectdata:SetStart(self.Entity:GetPos())
effectdata:SetOrigin(self.Entity:GetPos())
effectdata:SetScale(1.5)
util.Effect("HelicopterMegaBomb", effectdata)
local effectdata2 = EffectData()
effectdata2:SetStart(self.Entity:GetPos())
effectdata2:SetOrigin(self.Entity:GetPos())
effectdata2:SetScale(1.5)
util.Effect("Explosion", effectdata2)
self.Entity:EmitSound(Sound("weapons/explode3.wav"))
self.Entity:Remove()
end
function ENT:Touch()
self.DidHit = true
end
function ENT:PhysicsUpdate()
if (self.DidHit == true) then
self.Entity:Explode()
end
end
function ENT:PhysicsCollide( data, physobj )
self.DidHit = true
end | unlicense |
Zenny89/darkstar | scripts/zones/Port_Windurst/npcs/Kunchichi.lua | 38 | 1409 | -----------------------------------
-- Area: Port Windurst
-- NPC: Kunchichi
-- Type: Standard NPC
-- @pos -115.933 -4.25 109.533 240
-----------------------------------
package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/quests");
require("scripts/zones/Port_Windurst/TextIDs");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local WildcatWindurst = player:getVar("WildcatWindurst");
if (player:getQuestStatus(WINDURST,LURE_OF_THE_WILDCAT_WINDURST) == QUEST_ACCEPTED and player:getMaskBit(WildcatWindurst,15) == false) then
player:startEvent(0x026f);
else
player:startEvent(0x00e4);
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 == 0x026f) then
player:setMaskBit(player:getVar("WildcatWindurst"),"WildcatWindurst",15,true);
end
end;
| gpl-3.0 |
BlockMen/Wasteland | mods/wool/init.lua | 2 | 1804 | -- minetest/wool/init.lua
-- Backwards compatibility with jordach's 16-color wool mod
minetest.register_alias("wool:dark_blue", "wool:blue")
minetest.register_alias("wool:gold", "wool:yellow")
local wool = {}
-- This uses a trick: you can first define the recipes using all of the base
-- colors, and then some recipes using more specific colors for a few non-base
-- colors available. When crafting, the last recipes will be checked first.
wool.dyes = {
{"white", "White", nil},
{"grey", "Grey", "basecolor_grey"},
{"black", "Black", "basecolor_black"},
{"red", "Red", "basecolor_red"},
{"yellow", "Yellow", "basecolor_yellow"},
{"green", "Green", "basecolor_green"},
{"cyan", "Cyan", "basecolor_cyan"},
{"blue", "Blue", "basecolor_blue"},
{"magenta", "Magenta", "basecolor_magenta"},
{"orange", "Orange", "excolor_orange"},
{"violet", "Violet", "excolor_violet"},
{"brown", "Brown", "unicolor_dark_orange"},
{"pink", "Pink", "unicolor_light_red"},
{"dark_grey", "Dark Grey", "unicolor_darkgrey"},
{"dark_green", "Dark Green", "unicolor_dark_green"},
}
for _, row in ipairs(wool.dyes) do
local name = row[1]
local desc = row[2]
local craft_color_group = row[3]
-- Node Definition
minetest.register_node("wool:"..name, {
description = desc.." Wool",
tiles = {"wool_"..name..".png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3,wool=1},
sounds = default.node_sound_defaults(),
stack_max = 40,
})
if craft_color_group then
-- Crafting from dye and white wool
minetest.register_craft({
type = "shapeless",
output = 'wool:'..name,
recipe = {'group:dye,'..craft_color_group, 'group:wool'},
})
end
end
| gpl-3.0 |
mercury233/ygopro-scripts | c95750695.lua | 2 | 2777 | --スーペルヴィス
function c95750695.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+EFFECT_FLAG_CONTINUOUS_TARGET)
e1:SetTarget(c95750695.target)
e1:SetOperation(c95750695.operation)
c:RegisterEffect(e1)
--duel status
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_DUAL_STATUS)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(c95750695.eqlimit)
c:RegisterEffect(e3)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(95750695,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCondition(c95750695.spcon)
e4:SetTarget(c95750695.sptg)
e4:SetOperation(c95750695.spop)
c:RegisterEffect(e4)
end
c95750695.has_text_type=TYPE_DUAL
function c95750695.eqlimit(e,c)
return c:IsType(TYPE_DUAL)
end
function c95750695.filter(c)
return c:IsFaceup() and c:IsType(TYPE_DUAL)
end
function c95750695.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c95750695.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c95750695.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c95750695.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c95750695.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) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
end
end
function c95750695.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousPosition(POS_FACEUP)
and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c95750695.spfilter(c,e,tp)
return c:IsType(TYPE_NORMAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c95750695.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c95750695.spfilter(chkc,e,tp) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c95750695.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c95750695.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
| gpl-2.0 |
mercury233/ygopro-scripts | c11232355.lua | 6 | 2142 | --ディストラクター
function c11232355.initial_effect(c)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(11232355,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCost(c11232355.descost)
e1:SetTarget(c11232355.destg)
e1:SetOperation(c11232355.desop)
c:RegisterEffect(e1)
--self destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(11232355,1))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c11232355.sdcon)
e2:SetTarget(c11232355.sdtg)
e2:SetOperation(c11232355.sdop)
c:RegisterEffect(e2)
end
function c11232355.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
function c11232355.filter(c)
return c:IsFacedown()
end
function c11232355.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsControler(1-tp) and c11232355.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c11232355.filter,tp,0,LOCATION_SZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c11232355.filter,tp,0,LOCATION_SZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c11232355.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFacedown() and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c11232355.cfilter(c)
return c:IsFaceup() and c:IsRace(RACE_PSYCHO)
end
function c11232355.sdcon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(c11232355.cfilter,tp,LOCATION_MZONE,0,1,e:GetHandler())
end
function c11232355.sdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
end
function c11232355.sdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.Destroy(c,REASON_EFFECT)
end
end
| gpl-2.0 |
valhallaGaming/uno | src_trunk/resources/social-system/s_player_rightclick.lua | 1 | 7451 | function retrievePlayerInfo(targetPlayer)
local accid = tonumber(getElementData(source, "gameaccountid"))
local targetID = tonumber(getElementData(targetPlayer, "gameaccountid"))
local result = mysql_query(handler, "SELECT friend FROM friends WHERE id = " .. accid .. " AND friend = " .. targetID .. " LIMIT 1")
if result then
local friend = false
if mysql_num_rows( result ) == 1 then
friend = true
end
mysql_free_result( result )
local result = mysql_query(handler, "SELECT description, age, weight, height, skincolor FROM characters WHERE charactername='" .. getPlayerName(targetPlayer) .. "'")
local description = tostring(mysql_result(result, 1, 1))
local age = tostring(mysql_result(result, 1, 2))
local weight = tostring(mysql_result(result, 1, 3))
local height = tostring(mysql_result(result, 1, 4))
local race = tonumber(mysql_result(result, 1, 5))
mysql_free_result(result)
triggerClientEvent(source, "displayPlayerMenu", source, targetPlayer, friend, description, age, weight, height, race)
end
end
addEvent("sendPlayerInfo", true)
addEventHandler("sendPlayerInfo", getRootElement(), retrievePlayerInfo)
function addFriend(player)
local accid = tonumber(getElementData(source, "gameaccountid"))
local targetID = tonumber(getElementData(player, "gameaccountid"))
local countresult = mysql_query(handler, "SELECT COUNT(*) FROM friends WHERE id='" .. accid .. "' LIMIT 1")
local count = tonumber(mysql_result(countresult, 1, 1))
mysql_free_result(countresult)
if (count >=23) then
outputChatBox("Your friends list is currently full.", source, 255, 0, 0)
else
local result = mysql_query( handler, "INSERT INTO friends VALUES (" .. accid .. ", " .. targetID .. ")")
if result then
local friends = getElementData(source, "friends")
if friends then
friends[ targetID ] = true
setElementData(source, "friends", friends, false)
end
outputChatBox("'" .. getPlayerName(player) .. "' was added to your friends list.", source, 255, 194, 14)
mysql_free_result( result )
else
outputDebugString( "Add Friend: " .. mysql_error( handler ) )
end
end
end
addEvent("addFriend", true)
addEventHandler("addFriend", getRootElement(), addFriend)
-- FRISKING
--[[
function friskTakePlayerItem(player, itemID, itemValue, itemName)
exports.global:sendLocalMeAction(source, "takes a " .. itemName .. " from " .. getPlayerName(player) .. ".")
exports.global:takeItem(player, itemID, itemValue)
exports.global:giveItem(source, itemID, itemValue)
end
addEvent("friskTakePlayerItem", true)
addEventHandler("friskTakePlayerItem", getRootElement(), friskTakePlayerItem)
function friskTakePlayerWeapon(player, weaponID, weaponAmmo)
exports.global:sendLocalMeAction(source, "takes a " .. getWeaponNameFromID(weaponID) .. " from " .. getPlayerName(player) .. ".")
exports.global:takeWeapon(player, weaponID)
exports.global:giveWeapon(source, weaponID, weaponAmmo)
end
addEvent("friskTakePlayerWeapon", true)
addEventHandler("friskTakePlayerWeapon", getRootElement(), friskTakePlayerWeapon)]]
function toggleCuffs(cuffed, player)
if (cuffed) then
toggleControl(player, "fire", false)
toggleControl(player, "sprint", false)
toggleControl(player, "jump", false)
toggleControl(player, "next_weapon", false)
toggleControl(player, "previous_weapon", false)
toggleControl(player, "accelerate", false)
toggleControl(player, "brake_reverse", false)
toggleControl(player, "aim_weapon", false)
else
toggleControl(player, "fire", true)
toggleControl(player, "sprint", true)
toggleControl(player, "jump", true)
toggleControl(player, "next_weapon", true)
toggleControl(player, "previous_weapon", true)
toggleControl(player, "accelerate", true)
toggleControl(player, "brake_reverse", true)
toggleControl(player, "aim_weapon", true)
end
end
-- RESTRAINING
function restrainPlayer(player, restrainedObj)
local username = getPlayerName(source)
local targetPlayerName = getPlayerName(player)
local dbid = getElementData(source, "dbid")
setTimer(toggleCuffs, 200, 1, true, player)
outputChatBox("You have been restrained by " .. username .. ".", player)
outputChatBox("You are restraining " .. targetPlayerName .. ".", source)
setElementData(player, "restrain", 1)
setElementData(player, "restrainedObj", restrainedObj)
setElementData(player, "restrainedBy", dbid, false)
exports.global:takeItem(source, restrainedObj)
if (restrainedObj==45) then -- If handcuffs.. give the key
exports.global:giveItem(source, 47, dbid)
end
exports.global:removeAnimation(player)
end
addEvent("restrainPlayer", true)
addEventHandler("restrainPlayer", getRootElement(), restrainPlayer)
function unrestrainPlayer(player, restrainedObj)
local username = getPlayerName(source)
local targetPlayerName = getPlayerName(player)
outputChatBox("You have been unrestrained by " .. username .. ".", player)
outputChatBox("You are unrestraining " .. targetPlayerName .. ".", source)
setTimer(toggleCuffs, 200, 1, false, player)
setElementData(player, "restrain", 0)
removeElementData(player, "restrainedBy")
removeElementData(player, "restrainedObj")
if (restrainedObj==45) then -- If handcuffs.. take the key
local dbid = getElementData(source, "dbid")
exports.global:takeItem(source, 47, dbid)
end
exports.global:giveItem(source, restrainedObj, 1)
exports.global:removeAnimation(player)
end
addEvent("unrestrainPlayer", true)
addEventHandler("unrestrainPlayer", getRootElement(), unrestrainPlayer)
-- BLINDFOLDS
function blindfoldPlayer(player)
local username = getPlayerName(source)
local targetPlayerName = getPlayerName(player)
outputChatBox("You have been blindfolded by " .. username .. ".", player)
outputChatBox("You blindfolded " .. targetPlayerName .. ".", source)
exports.global:takeItem(source, 66) -- take their blindfold
setElementData(player, "blindfold", 1)
fadeCamera(player, false)
end
addEvent("blindfoldPlayer", true)
addEventHandler("blindfoldPlayer", getRootElement(), blindfoldPlayer)
function removeblindfoldPlayer(player)
local username = getPlayerName(source)
local targetPlayerName = getPlayerName(player)
outputChatBox("You have had your blindfold removed by " .. username .. ".", player)
outputChatBox("You removed " .. targetPlayerName .. "'s blindfold.", source)
exports.global:giveItem(source, 66, -1) -- give the remove the blindfold
removeElementData(player, "blindfold")
fadeCamera(player, true)
end
addEvent("removeBlindfold", true)
addEventHandler("removeBlindfold", getRootElement(), removeblindfoldPlayer)
-- STABILIZE
function stabilizePlayer(player)
local found, slot, itemValue = exports.global:hasItem(source, 70)
if found then
exports.global:takeItem(source, 70, itemValue)
itemValue = itemValue - 1
if itemValue > 0 then
exports.global:giveItem(source, 70, itemValue)
end
local username = getPlayerName(source)
local targetPlayerName = getPlayerName(player)
outputChatBox("You have been stabilized by " .. username .. ".", player)
outputChatBox("You stabilized " .. targetPlayerName .. ".", source)
triggerEvent("onPlayerStabilize", player)
end
end
addEvent("stabilizePlayer", true)
addEventHandler("stabilizePlayer", getRootElement(), stabilizePlayer) | bsd-3-clause |
linushsao/marsu_game-linus-v0.2 | mods/plantlife/farming/wheat.lua | 11 | 3878 |
local S = farming.intllib
-- wheat seeds
minetest.register_node("farming:seed_wheat", {
description = S("Wheat Seed"),
tiles = {"farming_wheat_seed.png"},
inventory_image = "farming_wheat_seed.png",
wield_image = "farming_wheat_seed.png",
drawtype = "signlike",
groups = {seed = 1, snappy = 3, attached_node = 1},
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
end,
})
-- harvested wheat
minetest.register_craftitem("farming:wheat", {
description = S("Wheat"),
inventory_image = "farming_wheat.png",
})
-- straw
minetest.register_node("farming:straw", {
description = S("Straw"),
tiles = {"farming_straw.png"},
is_ground_content = false,
groups = {snappy = 3, flammable = 4},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craft({
output = "farming:straw 3",
recipe = {
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"farming:wheat", "farming:wheat", "farming:wheat"},
}
})
minetest.register_craft({
output = "farming:wheat 3",
recipe = {
{"farming:straw"},
}
})
-- flour
minetest.register_craftitem("farming:flour", {
description = S("Flour"),
inventory_image = "farming_flour.png",
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"}
})
-- bread
minetest.register_craftitem("farming:bread", {
description = S("Bread"),
inventory_image = "farming_bread.png",
on_use = minetest.item_eat(5),
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:bread",
recipe = "farming:flour"
})
-- wheat definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_wheat_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:wheat_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_wheat_2.png"}
minetest.register_node("farming:wheat_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_wheat_3.png"}
minetest.register_node("farming:wheat_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_wheat_4.png"}
minetest.register_node("farming:wheat_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_wheat_5.png"}
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 2},
}
}
minetest.register_node("farming:wheat_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_wheat_6.png"}
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 1},
}
}
minetest.register_node("farming:wheat_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_wheat_7.png"}
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 3},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 3},
}
}
minetest.register_node("farming:wheat_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_wheat_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 3},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 3},
}
}
minetest.register_node("farming:wheat_8", table.copy(crop_def))
| gpl-3.0 |
Cavitt/vanilla-ot | data/talkactions/scripts/teleportto.lua | 1 | 1696 | function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return true
end
local creature = getCreatureByName(param)
local player = getPlayerByNameWildcard(param)
local waypoint = getWaypointPosition(param)
local tile = string.explode(param, ",")
local pos = {x = 0, y = 0, z = 0}
if(player ~= nil and (not isPlayerGhost(player) or getPlayerGhostAccess(player) <= getPlayerGhostAccess(cid))) then
pos = getCreaturePosition(player)
elseif(creature ~= nil and (not isPlayer(creature) or (not isPlayerGhost(creature) or getPlayerGhostAccess(creature) <= getPlayerGhostAccess(cid)))) then
pos = getCreaturePosition(creature)
elseif(isInArray({'back', 'last'}, param:lower())) then
pos = getCreatureLastPosition(cid)
elseif(type(waypoint) == 'table' and waypoint.x ~= 0 and waypoint.y ~= 0) then
pos = waypoint
elseif(tile[2] and tile[3]) then
pos = {x = tile[1], y = tile[2], z = tile[3]}
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
return true
end
if(not pos or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
return true
end
pos = getClosestFreeTile(cid, pos, true, false)
if(not pos or isInArray({pos.x, pos.y}, 0)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
return true
end
local tmp = getCreaturePosition(cid)
if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
end
return true
end
| agpl-3.0 |
mercury233/ygopro-scripts | c53567095.lua | 4 | 1671 | --ゴッドバードアタック
function c53567095.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCost(c53567095.cost)
e1:SetTarget(c53567095.target)
e1:SetOperation(c53567095.activate)
c:RegisterEffect(e1)
end
function c53567095.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
return true
end
function c53567095.desfilter(c,tc,ec)
return c:GetEquipTarget()~=tc and c~=ec
end
function c53567095.costfilter(c,ec,tp)
if not c:IsRace(RACE_WINDBEAST) then return false end
return Duel.IsExistingTarget(c53567095.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,c,c,ec)
end
function c53567095.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return chkc:IsOnField() and chkc~=c end
if chk==0 then
if e:GetLabel()==1 then
e:SetLabel(0)
return Duel.CheckReleaseGroup(tp,c53567095.costfilter,1,c,c,tp)
else
return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,c)
end
end
if e:GetLabel()==1 then
e:SetLabel(0)
local sg=Duel.SelectReleaseGroup(tp,c53567095.costfilter,1,1,c,c,tp)
Duel.Release(sg,REASON_COST)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,2,c)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,0,0)
end
function c53567095.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
Duel.Destroy(sg,REASON_EFFECT)
end
| gpl-2.0 |
Zenny89/darkstar | scripts/globals/items/slab_of_ruszor_meat.lua | 18 | 1289 | -----------------------------------------
-- ID: 5755
-- Item: Slab of Ruszor Meat
-- Food Effect: 30Min, Galka only
-----------------------------------------
-- Strength 5
-- Intelligence -7
-----------------------------------------
require("scripts/globals/status");
-----------------------------------------
-- OnItemCheck
-----------------------------------------
function onItemCheck(target)
result = 0;
if (target:getRace() ~= 8) then
result = 247;
end
if (target:getMod(MOD_EAT_RAW_MEAT) == 1) then
result = 0;
end
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,5755);
end;
-----------------------------------------
-- onEffectGain Action
-----------------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_STR, 5);
target:addMod(MOD_INT, -7);
end;
-----------------------------------------
-- onEffectLose Action
-----------------------------------------
function onEffectLose(target,effect)
target:delMod(MOD_STR, 5);
target:delMod(MOD_INT, -7);
end;
| gpl-3.0 |
ArmanKiIng/telegram--bot | plugins/qr.lua | 637 | 1730 | --[[
* qr plugin uses:
* - http://goqr.me/api/doc/create-qr-code/
* psykomantis
]]
local function get_hex(str)
local colors = {
red = "f00",
blue = "00f",
green = "0f0",
yellow = "ff0",
purple = "f0f",
white = "fff",
black = "000",
gray = "ccc"
}
for color, value in pairs(colors) do
if color == str then
return value
end
end
return str
end
local function qr(receiver, text, color, bgcolor)
local url = "http://api.qrserver.com/v1/create-qr-code/?"
.."size=600x600" --fixed size otherways it's low detailed
.."&data="..URL.escape(text:trim())
if color then
url = url.."&color="..get_hex(color)
end
if bgcolor then
url = url.."&bgcolor="..get_hex(bgcolor)
end
local response, code, headers = http.request(url)
if code ~= 200 then
return "Oops! Error: " .. code
end
if #response > 0 then
send_photo_from_url(receiver, url)
return
end
return "Oops! Something strange happened :("
end
local function run(msg, matches)
local receiver = get_receiver(msg)
local text = matches[1]
local color
local back
if #matches > 1 then
text = matches[3]
color = matches[2]
back = matches[1]
end
return qr(receiver, text, color, back)
end
return {
description = {"qr code plugin for telegram, given a text it returns the qr code"},
usage = {
"!qr [text]",
'!qr "[background color]" "[data color]" [text]\n'
.."Color through text: red|green|blue|purple|black|white|gray\n"
.."Colors through hex notation: (\"a56729\" is brown)\n"
.."Or colors through decimals: (\"255-192-203\" is pink)"
},
patterns = {
'^!qr "(%w+)" "(%w+)" (.+)$',
"^!qr (.+)$"
},
run = run
} | gpl-2.0 |
focusworld/telemamal | plugins/qr.lua | 637 | 1730 | --[[
* qr plugin uses:
* - http://goqr.me/api/doc/create-qr-code/
* psykomantis
]]
local function get_hex(str)
local colors = {
red = "f00",
blue = "00f",
green = "0f0",
yellow = "ff0",
purple = "f0f",
white = "fff",
black = "000",
gray = "ccc"
}
for color, value in pairs(colors) do
if color == str then
return value
end
end
return str
end
local function qr(receiver, text, color, bgcolor)
local url = "http://api.qrserver.com/v1/create-qr-code/?"
.."size=600x600" --fixed size otherways it's low detailed
.."&data="..URL.escape(text:trim())
if color then
url = url.."&color="..get_hex(color)
end
if bgcolor then
url = url.."&bgcolor="..get_hex(bgcolor)
end
local response, code, headers = http.request(url)
if code ~= 200 then
return "Oops! Error: " .. code
end
if #response > 0 then
send_photo_from_url(receiver, url)
return
end
return "Oops! Something strange happened :("
end
local function run(msg, matches)
local receiver = get_receiver(msg)
local text = matches[1]
local color
local back
if #matches > 1 then
text = matches[3]
color = matches[2]
back = matches[1]
end
return qr(receiver, text, color, back)
end
return {
description = {"qr code plugin for telegram, given a text it returns the qr code"},
usage = {
"!qr [text]",
'!qr "[background color]" "[data color]" [text]\n'
.."Color through text: red|green|blue|purple|black|white|gray\n"
.."Colors through hex notation: (\"a56729\" is brown)\n"
.."Or colors through decimals: (\"255-192-203\" is pink)"
},
patterns = {
'^!qr "(%w+)" "(%w+)" (.+)$',
"^!qr (.+)$"
},
run = run
} | gpl-2.0 |
qq779089973/my_openwrt_mod | luci/modules/niu/luasrc/model/cbi/niu/network/etherwan.lua | 50 | 5482 | --[[
LuCI - Lua Configuration Interface
Copyright 2009 Steven Barth <steven@midlink.org>
Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
local fs = require "nixio.fs"
local has_ipv6 = fs.access("/proc/net/ipv6_route")
local has_pptp = fs.access("/usr/sbin/pptp")
local has_pppd = fs.access("/usr/sbin/pppd")
local has_pppoe = fs.glob("/usr/lib/pppd/*/rp-pppoe.so")()
local has_pppoa = fs.glob("/usr/lib/pppd/*/pppoatm.so")()
m = Map("network", "Configure Ethernet Adapter for Internet Connection")
s = m:section(NamedSection, "wan", "interface")
s.addremove = false
s:tab("general", translate("General Settings"))
s:tab("expert", translate("Expert Settings"))
p = s:taboption("general", ListValue, "proto", translate("Connection Protocol"))
p.override_scheme = true
p.default = "dhcp"
p:value("dhcp", translate("Cable / Ethernet / DHCP"))
if has_pppoe then p:value("pppoe", "DSL / PPPoE") end
if has_pppoa then p:value("pppoa", "PPPoA") end
if has_pptp then p:value("pptp", "PPTP") end
p:value("static", translate("Static Ethernet"))
ipaddr = s:taboption("general", Value, "ipaddr", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address"))
ipaddr.rmempty = true
ipaddr:depends("proto", "static")
nm = s:taboption("general", Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask"))
nm.rmempty = true
nm:depends("proto", "static")
nm:value("255.255.255.0")
nm:value("255.255.0.0")
nm:value("255.0.0.0")
gw = s:taboption("general", Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway"))
gw:depends("proto", "static")
gw.rmempty = true
bcast = s:taboption("expert", Value, "bcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast"))
bcast:depends("proto", "static")
if has_ipv6 then
ip6addr = s:taboption("expert", Value, "ip6addr", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address"), translate("<abbr title=\"Classless Inter-Domain Routing\">CIDR</abbr>-Notation: address/prefix"))
ip6addr:depends("proto", "static")
ip6gw = s:taboption("expert", Value, "ip6gw", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway"))
ip6gw:depends("proto", "static")
end
dns = s:taboption("expert", Value, "dns", translate("<abbr title=\"Domain Name System\">DNS</abbr>-Server"))
dns:depends("peerdns", "")
mtu = s:taboption("expert", Value, "mtu", "MTU")
mtu.isinteger = true
mac = s:taboption("expert", Value, "macaddr", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
srv = s:taboption("general", Value, "server", translate("<abbr title=\"Point-to-Point Tunneling Protocol\">PPTP</abbr>-Server"))
srv:depends("proto", "pptp")
srv.rmempty = true
if has_pppd or has_pppoe or has_pppoa or has_pptp then
user = s:taboption("general", Value, "username", translate("Username"))
user.rmempty = true
user:depends("proto", "pptp")
user:depends("proto", "pppoe")
user:depends("proto", "pppoa")
pass = s:taboption("general", Value, "password", translate("Password"))
pass.rmempty = true
pass.password = true
pass:depends("proto", "pptp")
pass:depends("proto", "pppoe")
pass:depends("proto", "pppoa")
ka = s:taboption("expert", Value, "keepalive",
translate("Keep-Alive"),
translate("Number of failed connection tests to initiate automatic reconnect")
)
ka.default = "5"
ka:depends("proto", "pptp")
ka:depends("proto", "pppoe")
ka:depends("proto", "pppoa")
demand = s:taboption("expert", Value, "demand",
translate("Automatic Disconnect"),
translate("Time (in seconds) after which an unused connection will be closed")
)
demand:depends("proto", "pptp")
demand:depends("proto", "pppoe")
demand:depends("proto", "pppoa")
end
if has_pppoa then
encaps = s:taboption("expert", ListValue, "encaps", translate("PPPoA Encapsulation"))
encaps:depends("proto", "pppoa")
encaps:value("", translate("-- Please choose --"))
encaps:value("vc", "VC")
encaps:value("llc", "LLC")
vpi = s:taboption("expert", Value, "vpi", "VPI")
vpi:depends("proto", "pppoa")
vci = s:taboption("expert", Value, "vci", "VCI")
vci:depends("proto", "pppoa")
end
if has_pptp or has_pppd or has_pppoe or has_pppoa or has_3g then
--[[
defaultroute = s:taboption("expert", Flag, "defaultroute",
translate("Replace default route"),
translate("Let pppd replace the current default route to use the PPP interface after successful connect")
)
defaultroute:depends("proto", "pppoa")
defaultroute:depends("proto", "pppoe")
defaultroute:depends("proto", "pptp")
defaultroute.rmempty = false
function defaultroute.cfgvalue(...)
return ( AbstractValue.cfgvalue(...) or '1' )
end
]]
peerdns = s:taboption("expert", Flag, "peerdns",
translate("Use peer DNS"),
translate("Configure the local DNS server to use the name servers adverticed by the PPP peer")
)
peerdns:depends("proto", "pppoa")
peerdns:depends("proto", "pppoe")
peerdns:depends("proto", "pptp")
peerdns.rmempty = false
peerdns.default = "1"
if has_ipv6 then
ipv6 = s:taboption("expert", Flag, "ipv6", translate("Enable IPv6 on PPP link") )
ipv6:depends("proto", "pppoa")
ipv6:depends("proto", "pppoe")
ipv6:depends("proto", "pptp")
end
end
return m
| mit |
mercury233/ygopro-scripts | c79402185.lua | 2 | 2943 | --ボンディング-D2O
function c79402185.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:SetCost(c79402185.cost)
e1:SetTarget(c79402185.target)
e1:SetOperation(c79402185.activate)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,79402185)
e2:SetCondition(c79402185.thcon)
e2:SetTarget(c79402185.thtg)
e2:SetOperation(c79402185.thop)
c:RegisterEffect(e2)
end
c79402185.spchecks=aux.CreateChecks(Card.IsCode,{43017476,43017476,58071123})
function c79402185.costfilter(c,tp)
return c:IsCode(43017476,58071123) and (c:IsControler(tp) or c:IsFaceup())
end
function c79402185.fgoal(g,tp)
return Duel.GetMZoneCount(tp,g)>0 and Duel.CheckReleaseGroupEx(tp,aux.IsInGroup,#g,nil,g)
end
function c79402185.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
local g=Duel.GetReleaseGroup(tp,true):Filter(c79402185.costfilter,nil,tp)
if chk==0 then return g:CheckSubGroupEach(c79402185.spchecks,c79402185.fgoal,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg=g:SelectSubGroupEach(tp,c79402185.spchecks,false,c79402185.fgoal,tp)
aux.UseExtraReleaseCount(rg,tp)
Duel.Release(rg,REASON_COST)
end
function c79402185.filter(c,e,tp)
return c:IsCode(85066822,6022371) and c:IsCanBeSpecialSummoned(e,0,tp,true,true)
end
function c79402185.target(e,tp,eg,ep,ev,re,r,rp,chk)
local res=e:GetLabel()==1 or Duel.GetLocationCount(tp,LOCATION_MZONE)>0
if chk==0 then
e:SetLabel(0)
return res and Duel.IsExistingMatchingCard(c79402185.filter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
function c79402185.activate(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(c79402185.filter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP)
g:GetFirst():CompleteProcedure()
end
end
function c79402185.thcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c79402185.thfilter,1,nil) and not eg:IsContains(e:GetHandler())
end
function c79402185.thfilter(c)
return (c:IsCode(85066822) or c:IsCode(6022371)) and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function c79402185.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function c79402185.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
| gpl-2.0 |
pekeler/arangodb | 3rdParty/V8-4.3.61/tools/gcmole/gcmole.lua | 26 | 13876 | -- Copyright 2011 the V8 project authors. All rights reserved.
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are
-- met:
--
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above
-- copyright notice, this list of conditions and the following
-- disclaimer in the documentation and/or other materials provided
-- with the distribution.
-- * Neither the name of Google Inc. nor the names of its
-- contributors may be used to endorse or promote products derived
-- from this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- This is main driver for gcmole tool. See README for more details.
-- Usage: CLANG_BIN=clang-bin-dir lua tools/gcmole/gcmole.lua [arm|ia32|x64]
local DIR = arg[0]:match("^(.+)/[^/]+$")
local FLAGS = {
-- Do not build gcsuspects file and reuse previously generated one.
reuse_gcsuspects = false;
-- Don't use parallel python runner.
sequential = false;
-- Print commands to console before executing them.
verbose = false;
-- Perform dead variable analysis (generates many false positives).
-- TODO add some sort of whiteliste to filter out false positives.
dead_vars = false;
-- When building gcsuspects whitelist certain functions as if they
-- can be causing GC. Currently used to reduce number of false
-- positives in dead variables analysis. See TODO for WHITELIST
-- below.
whitelist = true;
}
local ARGS = {}
for i = 1, #arg do
local flag = arg[i]:match "^%-%-([%w_-]+)$"
if flag then
local no, real_flag = flag:match "^(no)([%w_-]+)$"
if real_flag then flag = real_flag end
flag = flag:gsub("%-", "_")
if FLAGS[flag] ~= nil then
FLAGS[flag] = (no ~= "no")
else
error("Unknown flag: " .. flag)
end
else
table.insert(ARGS, arg[i])
end
end
local ARCHS = ARGS[1] and { ARGS[1] } or { 'ia32', 'arm', 'x64', 'arm64' }
local io = require "io"
local os = require "os"
function log(...)
io.stderr:write(string.format(...))
io.stderr:write "\n"
end
-------------------------------------------------------------------------------
-- Clang invocation
local CLANG_BIN = os.getenv "CLANG_BIN"
local CLANG_PLUGINS = os.getenv "CLANG_PLUGINS"
if not CLANG_BIN or CLANG_BIN == "" then
error "CLANG_BIN not set"
end
if not CLANG_PLUGINS or CLANG_PLUGINS == "" then
CLANG_PLUGINS = DIR
end
local function MakeClangCommandLine(
plugin, plugin_args, triple, arch_define, arch_options)
if plugin_args then
for i = 1, #plugin_args do
plugin_args[i] = "-Xclang -plugin-arg-" .. plugin
.. " -Xclang " .. plugin_args[i]
end
plugin_args = " " .. table.concat(plugin_args, " ")
end
return CLANG_BIN .. "/clang++ -std=c++11 -c "
.. " -Xclang -load -Xclang " .. CLANG_PLUGINS .. "/libgcmole.so"
.. " -Xclang -plugin -Xclang " .. plugin
.. (plugin_args or "")
.. " -Xclang -triple -Xclang " .. triple
.. " -D" .. arch_define
.. " -DENABLE_DEBUGGER_SUPPORT"
.. " -DV8_I18N_SUPPORT"
.. " -I./"
.. " -Ithird_party/icu/source/common"
.. " -Ithird_party/icu/source/i18n"
.. " " .. arch_options
end
local function IterTable(t)
return coroutine.wrap(function ()
for i, v in ipairs(t) do
coroutine.yield(v)
end
end)
end
local function SplitResults(lines, func)
-- Splits the output of parallel.py and calls func on each result.
-- Bails out in case of an error in one of the executions.
local current = {}
local filename = ""
for line in lines do
local new_file = line:match "^______________ (.*)$"
local code = line:match "^______________ finish (%d+) ______________$"
if code then
if tonumber(code) > 0 then
log(table.concat(current, "\n"))
log("Failed to examine " .. filename)
return false
end
log("-- %s", filename)
func(filename, IterTable(current))
elseif new_file then
filename = new_file
current = {}
else
table.insert(current, line)
end
end
return true
end
function InvokeClangPluginForEachFile(filenames, cfg, func)
local cmd_line = MakeClangCommandLine(cfg.plugin,
cfg.plugin_args,
cfg.triple,
cfg.arch_define,
cfg.arch_options)
if FLAGS.sequential then
log("** Sequential execution.")
for _, filename in ipairs(filenames) do
log("-- %s", filename)
local action = cmd_line .. " " .. filename .. " 2>&1"
if FLAGS.verbose then print('popen ', action) end
local pipe = io.popen(action)
func(filename, pipe:lines())
local success = pipe:close()
if not success then error("Failed to run: " .. action) end
end
else
log("** Parallel execution.")
local action = "python tools/gcmole/parallel.py \""
.. cmd_line .. "\" " .. table.concat(filenames, " ")
if FLAGS.verbose then print('popen ', action) end
local pipe = io.popen(action)
local success = SplitResults(pipe:lines(), func)
local closed = pipe:close()
if not (success and closed) then error("Failed to run: " .. action) end
end
end
-------------------------------------------------------------------------------
-- GYP file parsing
local function ParseGYPFile()
local gyp = ""
local gyp_files = { "tools/gyp/v8.gyp", "test/cctest/cctest.gyp" }
for i = 1, #gyp_files do
local f = assert(io.open(gyp_files[i]), "failed to open GYP file")
local t = f:read('*a')
gyp = gyp .. t
f:close()
end
local result = {}
for condition, sources in
gyp:gmatch "'sources': %[.-### gcmole%((.-)%) ###(.-)%]" do
if result[condition] == nil then result[condition] = {} end
for file in sources:gmatch "'%.%./%.%./src/([^']-%.cc)'" do
table.insert(result[condition], "src/" .. file)
end
for file in sources:gmatch "'(test-[^']-%.cc)'" do
table.insert(result[condition], "test/cctest/" .. file)
end
end
return result
end
local function EvaluateCondition(cond, props)
if cond == 'all' then return true end
local p, v = cond:match "(%w+):(%w+)"
assert(p and v, "failed to parse condition: " .. cond)
assert(props[p] ~= nil, "undefined configuration property: " .. p)
return props[p] == v
end
local function BuildFileList(sources, props)
local list = {}
for condition, files in pairs(sources) do
if EvaluateCondition(condition, props) then
for i = 1, #files do table.insert(list, files[i]) end
end
end
return list
end
local sources = ParseGYPFile()
local function FilesForArch(arch)
return BuildFileList(sources, { os = 'linux',
arch = arch,
mode = 'debug',
simulator = ''})
end
local mtConfig = {}
mtConfig.__index = mtConfig
local function config (t) return setmetatable(t, mtConfig) end
function mtConfig:extend(t)
local e = {}
for k, v in pairs(self) do e[k] = v end
for k, v in pairs(t) do e[k] = v end
return config(e)
end
local ARCHITECTURES = {
ia32 = config { triple = "i586-unknown-linux",
arch_define = "V8_TARGET_ARCH_IA32",
arch_options = "-m32" },
arm = config { triple = "i586-unknown-linux",
arch_define = "V8_TARGET_ARCH_ARM",
arch_options = "-m32" },
x64 = config { triple = "x86_64-unknown-linux",
arch_define = "V8_TARGET_ARCH_X64",
arch_options = "" },
arm64 = config { triple = "x86_64-unknown-linux",
arch_define = "V8_TARGET_ARCH_ARM64",
arch_options = "" },
}
-------------------------------------------------------------------------------
-- GCSuspects Generation
local gc, gc_caused, funcs
local WHITELIST = {
-- The following functions call CEntryStub which is always present.
"MacroAssembler.*CallExternalReference",
"MacroAssembler.*CallRuntime",
"CompileCallLoadPropertyWithInterceptor",
"CallIC.*GenerateMiss",
-- DirectCEntryStub is a special stub used on ARM.
-- It is pinned and always present.
"DirectCEntryStub.*GenerateCall",
-- TODO GCMole currently is sensitive enough to understand that certain
-- functions only cause GC and return Failure simulataneously.
-- Callsites of such functions are safe as long as they are properly
-- check return value and propagate the Failure to the caller.
-- It should be possible to extend GCMole to understand this.
"Heap.*AllocateFunctionPrototype",
-- Ignore all StateTag methods.
"StateTag",
-- Ignore printing of elements transition.
"PrintElementsTransition"
};
local function AddCause(name, cause)
local t = gc_caused[name]
if not t then
t = {}
gc_caused[name] = t
end
table.insert(t, cause)
end
local function resolve(name)
local f = funcs[name]
if not f then
f = {}
funcs[name] = f
if name:match "Collect.*Garbage" then
gc[name] = true
AddCause(name, "<GC>")
end
if FLAGS.whitelist then
for i = 1, #WHITELIST do
if name:match(WHITELIST[i]) then
gc[name] = false
end
end
end
end
return f
end
local function parse (filename, lines)
local scope
for funcname in lines do
if funcname:sub(1, 1) ~= '\t' then
resolve(funcname)
scope = funcname
else
local name = funcname:sub(2)
resolve(name)[scope] = true
end
end
end
local function propagate ()
log "** Propagating GC information"
local function mark(from, callers)
for caller, _ in pairs(callers) do
if gc[caller] == nil then
gc[caller] = true
mark(caller, funcs[caller])
end
AddCause(caller, from)
end
end
for funcname, callers in pairs(funcs) do
if gc[funcname] then mark(funcname, callers) end
end
end
local function GenerateGCSuspects(arch, files, cfg)
-- Reset the global state.
gc, gc_caused, funcs = {}, {}, {}
log ("** Building GC Suspects for %s", arch)
InvokeClangPluginForEachFile (files,
cfg:extend { plugin = "dump-callees" },
parse)
propagate()
local out = assert(io.open("gcsuspects", "w"))
for name, value in pairs(gc) do if value then out:write (name, '\n') end end
out:close()
local out = assert(io.open("gccauses", "w"))
out:write "GC = {"
for name, causes in pairs(gc_caused) do
out:write("['", name, "'] = {")
for i = 1, #causes do out:write ("'", causes[i], "';") end
out:write("};\n")
end
out:write "}"
out:close()
log ("** GCSuspects generated for %s", arch)
end
--------------------------------------------------------------------------------
-- Analysis
local function CheckCorrectnessForArch(arch)
local files = FilesForArch(arch)
local cfg = ARCHITECTURES[arch]
if not FLAGS.reuse_gcsuspects then
GenerateGCSuspects(arch, files, cfg)
end
local processed_files = 0
local errors_found = false
local function SearchForErrors(filename, lines)
processed_files = processed_files + 1
for l in lines do
errors_found = errors_found or
l:match "^[^:]+:%d+:%d+:" or
l:match "error" or
l:match "warning"
print(l)
end
end
log("** Searching for evaluation order problems%s for %s",
FLAGS.dead_vars and " and dead variables" or "",
arch)
local plugin_args
if FLAGS.dead_vars then plugin_args = { "--dead-vars" } end
InvokeClangPluginForEachFile(files,
cfg:extend { plugin = "find-problems",
plugin_args = plugin_args },
SearchForErrors)
log("** Done processing %d files. %s",
processed_files,
errors_found and "Errors found" or "No errors found")
return errors_found
end
local function SafeCheckCorrectnessForArch(arch)
local status, errors = pcall(CheckCorrectnessForArch, arch)
if not status then
print(string.format("There was an error: %s", errors))
errors = true
end
return errors
end
local errors = false
for _, arch in ipairs(ARCHS) do
if not ARCHITECTURES[arch] then
error ("Unknown arch: " .. arch)
end
errors = SafeCheckCorrectnessForArch(arch, report) or errors
end
os.exit(errors and 1 or 0)
| apache-2.0 |
Zenny89/darkstar | scripts/zones/RuLude_Gardens/npcs/Magian_Moogle_Orange.lua | 48 | 2326 | -----------------------------------
-- Area: Ru'Lude Gardens
-- NPC: Magian Moogle (Orange Bobble)
-- Type: Magian Trials NPC (Weapon/Empyrean Armor)
-- @pos -11 2.453 118 64
-----------------------------------
package.loaded["scripts/zones/RuLude_Gardens/TextIDs"] = nil;
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
require("scripts/zones/RuLude_Gardens/TextIDs");
require("scripts/globals/magiantrials");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
if (trade:getItemCount() == 1) then
local ItemID = trade:getItem();
local TrialInfo = getTrialInfo(ItemID);
local invalid = 0;
if (TrialInfo.t1 == 0 and TrialInfo.t2 == 0 and TrialInfo.t3 == 0 and TrialInfo.t4 == 0) then
invalid = 1;
end
player:startEvent(10124, TrialInfo.t1, TrialInfo.t2, TrialInfo.t3, TrialInfo.t4, 0, ItemID, 0, invalid);
else
-- placeholder for multi item trades such as geode etc.
end
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
if (player:getMainLvl() < 75) then
player:startEvent(10121);
elseif (player:hasKeyItem(MAGIAN_TRIAL_LOG) == false) then
player:startEvent(10122);
else
player:startEvent(10123); -- parameters unknown
end
end;
-----------------------------------
-- onEventUpdate
-----------------------------------
function onEventUpdate(player,csid,option)
printf("CSID: %u",csid);
printf("RESULT: %u",option);
if (csid == 10124) then
local ItemID =0 ;
if (option == 4456449) then
ItemID = 19327;
elseif (option == 4456449) then
ItemID = 19327;
end
magianOrangeEventUpdate(player,ItemID,csid,option);
end
end;
-----------------------------------
-- onEventFinish
-----------------------------------
function onEventFinish(player,csid,option)
printf("CSID: %u",csid);
printf("RESULT: %u",option);
if (csid == 10122 and option == 1) then
player:messageSpecial(KEYITEM_OBTAINED,MAGIAN_TRIAL_LOG);
player:addKeyItem(MAGIAN_TRIAL_LOG);
--elseif
--
end
end; | gpl-3.0 |
Zenny89/darkstar | scripts/globals/spells/bluemagic/seedspray.lua | 18 | 2149 | -----------------------------------------
-- Spell: Seedspray
-- Delivers a threefold attack. Additional effect: Weakens defense. Chance of effect varies with TP
-- Spell cost: 61 MP
-- Monster Type: Plantoids
-- Spell Type: Physical (Slashing)
-- Blue Magic Points: 2
-- Stat Bonus: VIT+1
-- Level: 61
-- Casting Time: 4 seconds
-- Recast Time: 35 seconds
-- Skillchain Element(s): Ice (Primary) and Wind (Secondary) - (can open Impaction, Compression, Fragmentation, Scission or Gravitation; can close Induration or Detonation)
-- Combos: Beast Killer
-----------------------------------------
require("scripts/globals/magic");
require("scripts/globals/status");
require("scripts/globals/bluemagic");
-----------------------------------------
-- OnMagicCastingCheck
-----------------------------------------
function onMagicCastingCheck(caster,target,spell)
return 0;
end;
-----------------------------------------
-- OnSpellCast
-----------------------------------------
function onSpellCast(caster,target,spell)
local params = {};
-- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage
params.tpmod = TPMOD_CRITICAL;
params.dmgtype = DMGTYPE_SLASH;
params.scattr = SC_GRAVITATION;
params.numhits = 3;
params.multiplier = 1.925;
params.tp150 = 1.25;
params.tp300 = 1.25;
params.azuretp = 1.25;
params.duppercap = 61;
params.str_wsc = 0.0;
params.dex_wsc = 0.30;
params.vit_wsc = 0.0;
params.agi_wsc = 0.0;
params.int_wsc = 0.20;
params.mnd_wsc = 0.0;
params.chr_wsc = 0.0;
damage = BluePhysicalSpell(caster, target, spell, params);
damage = BlueFinalAdjustments(caster, target, spell, damage, params);
local chance = math.random();
if (damage > 0 and chance > 1) then
local typeEffect = EFFECT_DEFENSE_DOWN;
target:delStatusEffect(typeEffect);
target:addStatusEffect(typeEffect,4,0,getBlueEffectDuration(caster,resist,typeEffect));
end
return damage;
end; | gpl-3.0 |
mercury233/ygopro-scripts | c36010310.lua | 2 | 2908 | --溟界の滓-ヌル
function c36010310.initial_effect(c)
--to grave
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(36010310,0))
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,36010310)
e1:SetCost(c36010310.tgcost)
e1:SetTarget(c36010310.tgtg)
e1:SetOperation(c36010310.tgop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(36010310,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,36010311)
e2:SetCondition(c36010310.spcon)
e2:SetTarget(c36010310.sptg)
e2:SetOperation(c36010310.spop)
c:RegisterEffect(e2)
end
function c36010310.tgcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c36010310.tgfilter(c)
return c:IsRace(RACE_REPTILE) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToGrave()
end
function c36010310.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c36010310.tgfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function c36010310.tgop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c36010310.tgfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
function c36010310.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x161)
end
function c36010310.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or Duel.IsExistingMatchingCard(c36010310.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c36010310.sptg(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 c36010310.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
if Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_REDIRECT)
e1:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
e2:SetRange(LOCATION_MZONE)
e2:SetAbsoluteRange(tp,1,0)
e2:SetTarget(c36010310.splimit)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e2)
end
Duel.SpecialSummonComplete()
end
end
function c36010310.splimit(e,c)
return not c:IsRace(RACE_REPTILE)
end
| gpl-2.0 |
mercury233/ygopro-scripts | c63708033.lua | 2 | 1857 | --春化精と花蕾
function c63708033.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,63708033+EFFECT_COUNT_CODE_OATH)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetTarget(c63708033.target)
e1:SetOperation(c63708033.activate)
c:RegisterEffect(e1)
end
function c63708033.cfilter(c)
return c:IsSummonLocation(LOCATION_GRAVE) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsFaceup()
end
function c63708033.thfilter(c)
return c:IsFaceup() and c:IsAbleToHand()
end
function c63708033.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and c63708033.thfilter(chkc) end
local g=Duel.GetMatchingGroup(c63708033.cfilter,tp,LOCATION_MZONE,0,nil)
if chk==0 then return #g>0 and Duel.IsExistingTarget(c63708033.thfilter,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local ct=g:GetClassCount(Card.GetCode)
local sg=Duel.SelectTarget(tp,c63708033.thfilter,tp,0,LOCATION_ONFIELD,1,ct,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,sg,sg:GetCount()*2,0,0)
end
function c63708033.sfilter(c)
return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsFaceup() and c:IsAbleToHand()
end
function c63708033.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
local ct=g:GetCount()
local g2=Duel.GetMatchingGroup(c63708033.sfilter,tp,LOCATION_MZONE,0,nil)
if g2:GetCount()<ct then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local sg=g2:Select(tp,ct,ct,nil)
if Duel.SendtoHand(sg,nil,REASON_EFFECT)>0 and sg:IsExists(Card.IsLocation,1,nil,LOCATION_HAND) then
Duel.SendtoHand(tg,nil,REASON_EFFECT)
end
end
| gpl-2.0 |
dustine/ChargeTransmission | stdlib/prototype/prototype.lua | 1 | 1992 | --- Prototype module
-- @module Prototype
Prototype = {} --luacheck: allow defined top
Prototype.empty_sprite = require 'stdlib/prototype/modules/core'['empty_sprite']
Prototype.empty_animation = require 'stdlib/prototype/modules/core'['empty_animation']
--Quickly duplicate an existing prototype into a new one.
function Prototype.duplicate(data_type, orig_name, new_name, mining_result)
mining_result = type(mining_result) == "boolean" and new_name or mining_result
if data.raw[data_type][orig_name] then
local proto = table.deepcopy(data.raw[data_type][orig_name])
proto.name = new_name
if mining_result then
if proto.minable and proto.minable.result then
proto.minable.result = mining_result
end
end
if proto.place_result then
proto.place_result = new_name
end
if proto.result then
proto.result = new_name
end
return(proto)
else
error("Unknown Prototype "..data_type.."/".. orig_name )
end
end
--Prettier monolith extracting
function Prototype.extract_monolith(filename, x, y, w, h)
return {
type = "monolith",
top_monolith_border = 0,
right_monolith_border = 0,
bottom_monolith_border = 0,
left_monolith_border = 0,
monolith_image = {
filename = filename,
priority = "extra-high-no-scale",
width = w,
height = h,
x = x,
y = y,
},
}
end
Prototype.Data = require 'stdlib/prototype/modules/data'
Prototype.Pipes = require 'stdlib/prototype/modules/pipes'
Prototype.Technology = require 'stdlib/prototype/modules/technology'
Prototype.Item = require 'stdlib/prototype/modules/item'
Prototype.Category = require 'stdlib/prototype/modules/category'
Prototype.Entity = require 'stdlib/prototype/modules/entity'
Prototype.Recipe = require 'stdlib/prototype/modules/recipe'
return Prototype
| mit |
mercury233/ygopro-scripts | c9794980.lua | 3 | 2436 | --夢幻転星イドリース
function c9794980.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(9794980,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,9794980)
e1:SetCondition(c9794980.spcon)
e1:SetTarget(c9794980.sptg)
e1:SetOperation(c9794980.spop)
c:RegisterEffect(e1)
--to grave
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(9794980,1))
e2:SetCategory(CATEGORY_TOGRAVE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,9794981)
e2:SetCondition(c9794980.descon)
e2:SetTarget(c9794980.destg)
e2:SetOperation(c9794980.desop)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(c9794980.indtg)
e3:SetValue(1)
c:RegisterEffect(e3)
end
function c9794980.cfilter(c)
return c:IsFaceup() and c:IsType(TYPE_LINK)
end
function c9794980.spcon(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c9794980.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
return #g>0 and g:GetSum(Card.GetLink)>=8
end
function c9794980.sptg(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 c9794980.spop(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
function c9794980.descon(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(c9794980.cfilter,tp,LOCATION_MZONE,0,nil)
local g2=Duel.GetMatchingGroup(c9794980.cfilter,tp,0,LOCATION_MZONE,nil)
return #g2>#g1
end
function c9794980.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c9794980.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if chk==0 then return #g>0 end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,0,0)
end
function c9794980.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c9794980.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SendtoGrave(g,REASON_EFFECT)
end
function c9794980.indtg(e,c)
return c:IsLevel(9)
end
| gpl-2.0 |
Zenny89/darkstar | scripts/zones/Windurst_Walls/npcs/Raamimi.lua | 17 | 3005 | -----------------------------------
-- Area: Windurst Walls
-- Location: X:-81 Y:-9 Z:103
-- NPC: Raamimi
-- Working 100%
-- Involved in Quest: To Bee or Not to Bee?
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/quests");
-----------------------------------
-- onTrade Action
-----------------------------------
function onTrade(player,npc,trade)
end;
-----------------------------------
-- onTrigger Action
-----------------------------------
function onTrigger(player,npc)
local ToBee = player:getQuestStatus(WINDURST,TO_BEE_OR_NOT_TO_BEE);
local ToBeeOrNotStatus = player:getVar("ToBeeOrNot_var");
if (ToBeeOrNotStatus == 10 and ToBee == QUEST_AVAILABLE) then
player:startEvent(0x0043); -- Quest Started - He gives you honey
elseif (ToBee == QUEST_ACCEPTED) then
player:startEvent(0x0044); -- After honey is given to player...... but before 5th hondy is given to Zayhi
elseif (ToBee == QUEST_COMPLETED and ToBeeOrNotStatus == 5) then
player:startEvent(0x0050); -- Quest Finish - Gives Mulsum
elseif (ToBee == QUEST_COMPLETED and ToBeeOrNotStatus == 0 and player:needToZone()) then
player:startEvent(0x004F); -- After Quest but before zoning "it's certainly gotten quiet around here..."
else
player:startEvent(0x0128);
end
end;
-- Event ID List for NPC
-- player:startEvent(0x0128); -- Standard Conversation
-- player:startEvent(0x0043); -- Quest is kicked off already, he gives you honey
-- player:startEvent(0x0044); -- After honey is given to player...... before given to Zayhi????
-- player:startEvent(0x0050); -- Quest Finish - Gives Mulsum
-- player:startEvent(0x004F); -- After Quest but before zoning: "it's certainly gotten quiet around here..."
-----------------------------------
-- 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 == 0x0043) then
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,4370); -- Cannot give Honey because player Inventory is full
else
player:addQuest(WINDURST,TO_BEE_OR_NOT_TO_BEE);
player:addItem(4370);
player:messageSpecial(ITEM_OBTAINED, 4370); -- Gives player Honey x1
end
elseif (csid == 0x0050) then -- After Honey#5: ToBee quest Finish (tooth hurts from all the Honey)
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,4156); -- Cannot give Mulsum because player Inventory is full
else
player:setVar("ToBeeOrNot_var",0);
player:addItem(4156,3); -- Mulsum x3
player:messageSpecial(ITEMS_OBTAINED, 4156,3);
player:needToZone(true);
end
end
end;
| gpl-3.0 |
youtube/cobalt | third_party/skia/tools/lua/ngrams.lua | 41 | 2106 | -- Generate n-grams of Skia API calls from SKPs.
-- To test this locally, run:
-- $ GYP_DEFINES="skia_shared_lib=1" make lua_pictures
-- $ out/Debug/lua_pictures -q -r $SKP_DIR -l tools/lua/ngrams.lua > /tmp/lua-output
-- $ lua tools/lua/ngrams_aggregate.lua
-- To run on Cluster Telemetry, copy and paste the contents of this file into
-- the box at https://skia-tree-status.appspot.com/skia-telemetry/lua_script,
-- and paste the contents of ngrams_aggregate.lua into the "aggregator script"
-- box on the same page.
-- Change n as desired.
-- CHANGEME
local n = 3
-- CHANGEME
-- This algorithm uses a list-of-lists for each SKP. For API call, append a
-- list containing just the verb to the master list. Then, backtrack over the
-- last (n-1) sublists in the master list and append the verb to those
-- sublists. At the end of execution, the master list contains a sublist for
-- every verb in the SKP file. Each sublist has length n, with the exception of
-- the last n-1 sublists, which are discarded in the summarize() function,
-- which generates counts for each n-gram.
local ngrams = {}
local currentFile = ""
function sk_scrape_startcanvas(c, fileName)
currentFile = fileName
ngrams[currentFile] = {}
end
function sk_scrape_endcanvas(c, fileName)
end
function sk_scrape_accumulate(t)
table.insert(ngrams[currentFile], {t.verb})
for i = 1, n-1 do
local idx = #ngrams[currentFile] - i
if idx > 0 then
table.insert(ngrams[currentFile][idx], t.verb)
end
end
end
function sk_scrape_summarize()
-- Count the n-grams.
local counts = {}
for file, ngramsInFile in pairs(ngrams) do
for i = 1, #ngramsInFile - (n-1) do
local ngram = table.concat(ngramsInFile[i], " ")
if counts[ngram] == nil then
counts[ngram] = 1
else
counts[ngram] = counts[ngram] + 1
end
end
end
-- Write out code for aggregating.
for ngram, count in pairs(counts) do
io.write("if counts['", ngram, "'] == nil then counts['", ngram, "'] = ", count, " else counts['", ngram, "'] = counts['", ngram, "'] + ", count, " end\n")
end
end
| bsd-3-clause |
SharpWoW/Command | EventHandler.lua | 1 | 1494 | --[[
* Copyright (c) 2011-2012 by Adam Hellberg.
*
* This file is part of Command.
*
* Command 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.
*
* Command 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 Command. If not, see <http://www.gnu.org/licenses/>.
--]]
-- Upvalues
local pairs = pairs
-- API Upvalues
local CreateFrame = CreateFrame
local C = Command
local CES = C.Extensions.String
--- Handles events.
-- @name Command.OnEvent
-- @param frame The frame on which the event was registered.
-- @param event Full name of the event.
-- @param ... Event arguments.
--
function C:OnEvent(frame, event, ...)
if self.Loaded and not self.Settings.ENABLED then return end
if not self.Events[event] then return end
if CES:StartsWith(event, "CHAT_MSG_") then
self.Events[event](self, event, ...)
else
self.Events[event](self, ...)
end
end
C.Frame = CreateFrame("Frame")
for k,_ in pairs(C.Events) do
C.Frame:RegisterEvent(k)
end
C.Frame:SetScript("OnEvent", function(frame, event, ...) C:OnEvent(frame, event, ...) end)
| gpl-3.0 |
mercury233/ygopro-scripts | c57238939.lua | 4 | 1241 | --A・ジェネクス・リモート
function c57238939.initial_effect(c)
--cos
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(57238939,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(c57238939.costg)
e1:SetOperation(c57238939.cosop)
c:RegisterEffect(e1)
end
function c57238939.filter(c)
return c:IsFaceup() and c:IsType(TYPE_TUNER)
end
function c57238939.costg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c57238939.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c57238939.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c57238939.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c57238939.cosop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(68505803)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
end
| gpl-2.0 |
Firew0lf/ctruLua | sdcard/3ds/ctruLua/libs/filepicker.lua | 2 | 10207 | local ctr = require('ctr')
local keyboard = require('keyboard')
local gfx = ctr.gfx
local externalConfig
local function gfxPrepare()
local old = {gfx.get3D(), gfx.color.getDefault(), gfx.color.getBackground(),
gfx.font.getDefault(), gfx.font.getSize()}
local mono = gfx.font.load(ctr.root .. "resources/VeraMono.ttf")
gfx.set3D(false)
gfx.color.setDefault(0xFFFDFDFD)
gfx.color.setBackground(0xFF333333)
gfx.font.setDefault(mono)
gfx.font.setSize(12)
return old
end
local function gfxRestore(state)
gfx.set3D(state[1])
gfx.color.setDefault(state[2])
gfx.color.setBackground(state[3])
gfx.font.setDefault(state[4])
gfx.font.setSize(state[5])
end
local function systemBindings(bindings)
bindings.__default.up = {
function(_, selected, ...)
if selected.inList > 1 then
selected.inList = selected.inList - 1
if selected.inList == selected.offset then
selected.offset = selected.offset - 1
end
end
end
}
bindings.__default.down = {
function(externalConfig, selected, ...)
if selected.inList < #externalConfig.fileList then
selected.inList = selected.inList + 1
if selected.inList - selected.offset >= 16 then
selected.offset = selected.offset + 1
end
end
end
}
bindings.__default.left = {
function(_, selected, ...)
selected.inList, selected.offset = 1, 0
end
}
bindings.__default.right = {
function(externalConfig, selected, ...)
selected.inList = #externalConfig.fileList
if #externalConfig.fileList > 15 then
selected.offset = #externalConfig.fileList - 16
end
end
}
end
local function getFileList(workingDirectory)
local fileList = ctr.fs.list(workingDirectory)
if workingDirectory ~= "/" and workingDirectory ~= "sdmc:/" then
table.insert(fileList, {name = "..", isDirectory = true})
end
-- Stealy stealing code from original openfile.lua
table.sort(fileList, function(i, j)
if i.isDirectory and not j.isDirectory then
return true
elseif i.isDirectory == j.isDirectory then
return string.lower(i.name) < string.lower(j.name)
end
end)
return fileList
end
local function getBinding(selectedFile, bindings)
if selectedFile.isDirectory then
return bindings.__directory, "__directory"
end
for pattern, values in pairs(bindings) do
if selectedFile.name:match(pattern) then
return values, pattern
end
end
return bindings.__default, "__default"
end
local function drawBottom(externalConfig, workingDirectoryScroll, selected)
local workingDirectory = externalConfig.workingDirectory
local bindings = externalConfig.bindings
local selectedFile = externalConfig.fileList[selected.inList]
gfx.start(gfx.BOTTOM)
gfx.rectangle(0, 0, gfx.BOTTOM_WIDTH, 16, 0, 0xFF0000B3)
gfx.text(1 - workingDirectoryScroll.value, 0, workingDirectory)
if gfx.font.getDefault():width(workingDirectory) > gfx.BOTTOM_WIDTH - 2 then
workingDirectoryScroll.value = workingDirectoryScroll.value + workingDirectoryScroll.phase
if workingDirectoryScroll.value == (gfx.BOTTOM_WIDTH - 2) - gfx.font.getDefault():width(workingDirectory) or
workingDirectoryScroll.value == 0 then
workingDirectoryScroll.phase = - workingDirectoryScroll.phase
end
end
gfx.text(1, 15, selectedFile.name, 12)
if not selectedFile.isDirectory then
gfx.text(1, 45, tostring(selectedFile.size) .. "B", 12, 0xFF727272)
end
local binding, pattern = getBinding(selectedFile, bindings)
if selectedFile.isDirectory then
gfx.text(1, 30, bindings.__directory.__name, 12, 0xFF727272)
else
gfx.text(1, 30, binding.__name, 12, 0xFF727272)
end
local bindingNames = {
{"start", "Start"}, {"select", "Select"},
{"x", "X"}, {"y", "Y"},
{"b", "B"}, {"a", "A"},
{"r", "R"}, {"l", "L"},
{"zr", "ZR"}, {"zl", "ZL"},
{"cstickDown", "C Down"}, {"cstickUp", "C Up"},
{"cstickRight", "C Right"}, {"cstickLeft", "C Left"}
}
local j = 0
for i, v in ipairs(bindingNames) do
if binding[v[1]] and binding[v[1]][2] then
j = j + 1
gfx.text(1, gfx.BOTTOM_HEIGHT - 15*j, v[2] .. ": " .. binding[v[1]][2])
end
end
externalConfig.callbacks.drawBottom(externalConfig, selected)
gfx.stop()
end
local function drawTop(externalConfig, selected)
gfx.start(gfx.TOP)
gfx.rectangle(0, (selected.inList-selected.offset-1)*15, gfx.TOP_WIDTH, 16, 0, 0xFF0000B9)
local over = #externalConfig.fileList - selected.offset >= 16 and 16 or #externalConfig.fileList - selected.offset
for i=selected.offset+1, selected.offset+over do
local color = externalConfig.fileList[i].isDirectory and 0xFF727272 or 0xFFFDFDFD
gfx.text(1, (i-selected.offset-1)*15+1, externalConfig.fileList[i].name or "", 12, color)
end
externalConfig.callbacks.drawTop(externalConfig, selected)
gfx.stop()
end
local function eventHandler(externalConfig, selected)
externalConfig.callbacks.eventHandler(externalConfig, selected)
ctr.hid.read()
local state = ctr.hid.keys()
local binding, pattern = getBinding(externalConfig.fileList[selected.inList], externalConfig.bindings)
for k, v in pairs(binding) do
if k ~= "__name" and state.down[k] then
local a, b, c, key = v[1](externalConfig, selected, pattern, k)
if key then return a, b, c, key
else return end
end
end
for k, v in pairs(externalConfig.bindings.__default) do
if k ~= "__name" and state.down[k] then
local a, b, c, key = v[1](externalConfig, selected, pattern, k)
if key then return a, b, c, key
else break end
end
end
end
local function nothing(externalConfig, selected, bindingName, bindingKey)
-- externalConfig = {workingDirectory=string, bindings=table, callbacks=table, additionalArguments=table, fileList=table}
-- selected = {file=string, inList=number, offset=number}
-- bindings = {__default/__directory/[regex] = {__name, [keyName] = {(handlingFunction), (name)}}}
-- callbacks = {drawTop, drawBottom, eventHandler}
end
local function changeDirectory(externalConfig, selected, bindingName, bindingKey)
if externalConfig.fileList[selected.inList].isDirectory then
if externalConfig.fileList[selected.inList].name == ".." then
externalConfig.workingDirectory = externalConfig.workingDirectory:gsub("[^/]+/$", "")
else
externalConfig.workingDirectory = externalConfig.workingDirectory .. externalConfig.fileList[selected.inList].name .. "/"
end
externalConfig.fileList = getFileList(externalConfig.workingDirectory)
selected.inList, selected.offset = 1, 0
end
end
local function newFile(externalConfig, selected, bindingName, bindingKey)
local name = ""
while ctr.run() do
gfx.start(gfx.BOTTOM)
gfx.rectangle(0, 0, gfx.BOTTOM_WIDTH, 16, 0, 0xFF0000B3)
gfx.text(1, 0, externalConfig.workingDirectory)
keyboard.draw(4, 115)
gfx.stop()
gfx.start(gfx.TOP)
gfx.rectangle(0, 0, gfx.TOP_WIDTH, 16, 0, 0xFF0000B3)
gfx.text(1, 0, "Creating new file")
gfx.rectangle(4, gfx.TOP_HEIGHT // 2 - 15, gfx.TOP_WIDTH - 8, 30, 0, 0xFF727272)
gfx.text(5, gfx.TOP_HEIGHT // 2 - 6, name, 12)
gfx.stop()
gfx.render()
local char = (keyboard.read() or ""):gsub("[\t%/%?%<%>%\\%:%*%|%”%^]", "")
ctr.hid.read()
local keys = ctr.hid.keys()
if char ~= "" and char ~= "\b" and char ~= "\n" then
name = name .. char
elseif char ~= "" and char == "\b" then
name = name:sub(1, (utf8.offset(name, -1) or 0)-1)
elseif (char ~= "" and char == "\n" or keys.down.a) and name ~= "" then
local b, p = getBinding({name=name}, externalConfig.bindings)
return externalConfig.workingDirectory .. name, p, "new", b
elseif keys.down.b then
break
end
end
end
local function openFile(externalConfig, selected, bindingName, bindingKey)
return externalConfig.workingDirectory .. externalConfig.fileList[selected.inList].name,
bindingName, "open", bindingKey
end
local function filePicker(workingDirectory, bindings, callbacks, ...)
-- Argument sanitization
local additionalArguments = { ... }
workingDirectory = workingDirectory or ctr.fs.getDirectory()
bindings = bindings or {}
callbacks = callbacks or {}
for _, v in ipairs({"drawTop", "drawBottom", "eventHandler"}) do
if not callbacks[v] then
callbacks[v] = function(...) end
end
end
if workingDirectory:sub(utf8.offset(workingDirectory, -1) or -1) ~= "/" then
workingDirectory = workingDirectory .. "/"
end
-- Default Bindings
bindings.__default = bindings.__default or {}
bindings.__default.__name = bindings.__default.__name or "File"
bindings.__default.x = bindings.__default.x or {
function(externalConfig, ...)
return externalConfig.workingDirectory, "__directory", nil, "x"
end, "Quit"
}
bindings.__directory = bindings.__directory or {}
bindings.__directory.__name = bindings.__directory.__name or "Directory"
bindings.__directory.a = bindings.__directory.a or {
changeDirectory, "Open"
}
local movementKeys = {
"up" , "down" , "left" , "right" ,
"cpadUp", "cpadDown", "cpadLeft", "cpadRight",
"dUp" , "dDown" , "dLeft" , "dRight"
}
for k, v in pairs(bindings) do
if k ~= "__default" then
setmetatable(bindings[k], {__index = bindings.__default})
end
for _, w in ipairs(movementKeys) do
if v[w] then bindings[k][w] = nil end
end
end
systemBindings(bindings)
-- Other Initialization
local selected = {inList = 1, offset = 0}
local workingDirectoryScroll = { value = 0, phase = -1 }
local gfxState = gfxPrepare()
-- Main Loop
externalConfig = {workingDirectory=workingDirectory, bindings=bindings,
callbacks=callbacks, additionalArguments=additionalArguments,
fileList=getFileList(workingDirectory)}
while ctr.run() do
drawBottom(externalConfig, workingDirectoryScroll, selected)
drawTop(externalConfig, selected)
gfx.render()
local file, binding, mode, key = eventHandler(externalConfig, selected)
if key then
gfxRestore(gfxState)
return file, binding, mode, key
end
end
end
local returnTable = {filePicker = filePicker, openFile = openFile,
newFile = newFile, changeDirectory = changeDirectory}
setmetatable(returnTable, {__call = function(self, ...) return self.filePicker(...) end})
return returnTable | gpl-3.0 |
AlmightyLaxz/gmRPG | entities/entities/rpg_npc_supermarket.lua | 1 | 1297 | AddCSLuaFile()
ENT.Base = "rpg_npc_merchant_base"
ENT.Type = "ai"
ENT.PrintName = "NPC Supermarket Worker"
ENT.Author = "Almighty Laxz"
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Category = "gmRPG"
ENT.Spawnable = true
local titleText = "Supermarket Worker"
local merchantText = "Hello, can I help you?"
// for items
local merchantid = "supermarket"
if SERVER then
function ENT:Initialize( )
self:SetModel( "models/alyx.mdl" )
self:SetHullType( HULL_HUMAN )
self:SetHullSizeNormal( )
self:SetNPCState( NPC_STATE_SCRIPT )
self:SetSolid( SOLID_BBOX )
self:CapabilitiesAdd( CAP_ANIMATEDFACE, CAP_TURN_HEAD )
self:SetUseType( SIMPLE_USE )
self:DropToFloor()
end
function ENT:AcceptInput( Name, Activator, Caller )
if !Activator.cantUse and Activator:IsPlayer() then
Activator.cantUse = true
net.Start("rpgMerchantDermaStart")
net.WriteString(titleText)
net.WriteString(merchantText)
net.WriteString(merchantid)
net.WriteEntity(self)
net.Send(Activator)
timer.Simple(1, function()
Activator.cantUse = false
end)
end
end
end
| gpl-3.0 |
Zenny89/darkstar | scripts/zones/Lower_Jeuno/npcs/Navisse.lua | 34 | 4871 | -----------------------------------
-- Area: Lower Jeuno
-- NPC: Navisse
-- Standard Info NPC
-----------------------------------
package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil;
require("scripts/zones/Lower_Jeuno/TextIDs");
require("scripts/globals/pathfind");
local path = {
-- -59.562683, 6.000051, -90.890404,
-58.791367, 6.000050, -91.663391,
-58.021465, 6.000049, -92.432144,
-58.729881, 6.000051, -91.577568,
-60.351879, 6.000053, -89.835815,
-61.099354, 6.000054, -89.034248,
-61.841427, 5.999946, -88.238564,
-62.769325, 5.999948, -87.244301,
-61.750378, 5.999948, -87.684868,
-60.796600, 5.999947, -88.208214,
-55.475166, 5.999943, -91.271210,
-56.590668, 5.999943, -91.245201,
-57.651192, 6.000052, -91.002350,
-64.134392, 6.000052, -89.460915,
-63.261021, 6.000051, -90.107605,
-62.330879, 6.000051, -90.679604,
-61.395359, 6.000050, -91.235107,
-56.591644, 6.000047, -94.066406,
-57.208908, 6.000048, -93.245895,
-57.934330, 6.000049, -92.435081,
-59.788624, 6.000052, -90.439583,
-61.832211, 5.999946, -88.248795,
-62.574249, 5.999948, -87.453148,
-61.832058, 5.999946, -88.248627,
-61.089920, 6.000054, -89.044273,
-60.348049, 6.000053, -89.840111,
-59.043877, 6.000051, -91.238251,
-58.301846, 6.000050, -92.033958,
-57.467026, 6.000048, -92.929070,
-56.536987, 6.000047, -93.926826,
-57.528469, 6.000047, -93.482582,
-58.476944, 6.000048, -92.949654,
-59.416409, 6.000049, -92.400879,
-64.235306, 6.000051, -89.563835,
-64.000816, 6.000054, -88.482338,
-63.516331, 5.999947, -87.539917,
-62.444843, 5.999948, -87.352570,
-61.468765, 5.999947, -87.831436,
-60.520329, 5.999947, -88.364532,
-55.100037, 5.999943, -91.488144,
-56.063160, 5.999944, -90.932312,
-62.719467, 5.999948, -87.093468,
-62.064899, 5.999947, -87.960884,
-61.338562, 5.999946, -88.770836,
-59.579746, 6.000052, -90.663826,
-58.177391, 6.000050, -92.167343,
-57.435341, 6.000048, -92.963005,
-56.734436, 6.000047, -93.714989,
-57.492855, 6.000049, -92.901787,
-58.251190, 6.000050, -92.088486,
-59.364170, 6.000051, -90.894829,
-61.039413, 6.000054, -89.098907,
-61.784184, 5.999946, -88.300293,
-62.804745, 5.999948, -87.206451,
-60.463631, 6.000053, -89.715942,
-59.721657, 6.000052, -90.511711,
-58.974190, 6.000051, -91.313248,
-58.232239, 6.000050, -92.109024,
-56.840717, 6.000047, -93.600716,
-57.914623, 6.000048, -93.276276,
-58.855755, 6.000048, -92.730408,
-64.140175, 6.000051, -89.619812,
-63.025597, 6.000052, -89.751106,
-61.954758, 6.000052, -89.984474,
-60.887684, 6.000052, -90.234573,
-55.190853, 5.999943, -91.590721,
-55.368877, 6.000050, -92.667923,
-55.841885, 6.000048, -93.664970,
-56.916370, 6.000048, -93.400879,
-57.705578, 6.000049, -92.652748,
-58.456089, 6.000050, -91.865067,
-60.405739, 6.000053, -89.778008,
-61.147854, 6.000054, -88.982376,
-61.889904, 5.999946, -88.186691,
-62.637497, 5.999948, -87.385239,
-63.643429, 6.000055, -87.880524,
-64.248825, 6.000053, -88.784004,
-63.455921, 6.000052, -89.526733,
-62.418514, 6.000052, -89.852493,
-61.363335, 6.000052, -90.117607,
-55.142048, 5.999943, -91.602325,
-55.358624, 6.000050, -92.679016,
-55.842934, 6.000048, -93.675148,
-56.919590, 6.000048, -93.408241,
-57.710354, 6.000049, -92.649918,
-58.459896, 6.000050, -91.861336,
-60.409424, 6.000053, -89.774185,
-61.151508, 6.000054, -88.978500,
-62.848709, 5.999948, -87.159264,
-61.829231, 5.999948, -87.629791,
-60.951675, 5.999947, -88.117493,
-55.395309, 5.999943, -91.317513,
-56.522537, 5.999943, -91.263893,
-57.586517, 6.000052, -91.018196,
-64.081299, 6.000052, -89.473526,
-63.209583, 6.000051, -90.135269,
-62.270042, 6.000050, -90.714821,
-61.334797, 6.000050, -91.270729,
-56.586208, 6.000047, -94.069595,
-64.130554, 6.000051, -89.625450,
-56.496498, 6.000047, -94.122322,
-57.173595, 6.000048, -93.271568,
-57.904095, 6.000049, -92.465279,
-59.571453, 6.000052, -90.672951,
};
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(0x0099);
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 |
mercury233/ygopro-scripts | c9628664.lua | 9 | 1444 | --地母神アイリス
function c9628664.initial_effect(c)
--chain
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EVENT_CHAINING)
e1:SetRange(LOCATION_MZONE)
e1:SetOperation(c9628664.chop)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(9628664,0))
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EVENT_CHAIN_END)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c9628664.drcon)
e2:SetTarget(c9628664.drtg)
e2:SetOperation(c9628664.drop)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
end
function c9628664.chop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetCurrentChain()
if ct==1 then
e:SetLabel(0)
elseif not Duel.CheckChainUniqueness() then
e:SetLabel(2)
elseif ct>=3 and e:GetLabel()~=2 then
e:SetLabel(1)
end
end
function c9628664.drcon(e,tp,eg,ep,ev,re,r,rp)
local res=e:GetLabelObject():GetLabel()
e:GetLabelObject():SetLabel(0)
return res==1
end
function c9628664.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c9628664.drop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
| gpl-2.0 |
1yvT0s/lit | libs/db.lua | 5 | 6462 | --[[
Copyright 2014-2015 The Luvit Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
--[[
Mid Level Storage Commands
=========================
These commands work at a higher level and consume the low-level storage APIs.
db.has(hash) -> bool - check if db has an object
db.load(hash) -> raw - load raw data, nil if not found
db.loadAny(hash) -> kind, value - pre-decode data, error if not found
db.loadAs(kind, hash) -> value - pre-decode and check type or error
db.save(raw) -> hash - save pre-encoded and framed data
db.saveAs(kind, value) -> hash - encode, frame and save to objects/$ha/$sh
db.hashes() -> iter - Iterate over all hashes
db.match(author, name, version)
-> match, hash - Find the best version matching the query.
db.read(author, name, version) -> hash - Read from refs/tags/$author/$tag/v$version
db.write(author, name, version, hash) - Write to refs/tags/$suthor/$tag/v$version
db.authors() -> iter - Iterate over refs/tags/*
db.names(author) -> iter - Iterate nodes in refs/tags/$author/**
db.versions(author, name) -> iter - Iterate leaves in refs/tags/$author/$tag/*
db.readKey(author, fingerprint) -> key - Read from keys/$author/$fingerprint
db.putKey(author, fingerprint, key) - Write to keys/$author/$fingerprint
db.revokeKey(author, fingerprint) - Delete keys/$author/$fingerprint
db.fingerprints(author) -> iter - iter of fingerprints
db.getEtag(author) -> etag - Read keys/$author.etag
db.setEtag(author, etag) - Writes keys/$author.etag
db.owners(org) -> iter - Iterates lines of keys/$org.owners
db.isOwner(org, author) -> bool - Check if a user is an org owner
db.addOwner(org, author) - Add a new owner
db.removeOwner(org, author) - Remove an owner
db.import(fs, path) -> kind, hash - Import a file or tree into database
db.export(hash, path) -> kind - Export a hash to a path
]]
return function (rootPath)
local semver = require('semver')
local normalize = semver.normalize
local gfs = require('coro-fs')
local gitMount = require('git').mount
local import = require('import')
local export = require('export')
local db = gitMount(gfs.chroot(rootPath))
local storage = db.storage
local function assertHash(hash)
assert(hash and #hash == 40 and hash:match("^%x+$"), "Invalid hash")
end
function db.match(author, name, version)
local match = semver.match(version, db.versions(author, name))
if not match then return end
return match, assert(db.read(author, name, match))
end
function db.read(author, name, version)
version = normalize(version)
local ref = string.format("refs/tags/%s/%s/v%s", author, name, version)
return db.getRef(ref)
end
function db.write(author, name, version, hash)
version = normalize(version)
assertHash(hash)
local ref = string.format("refs/tags/%s/%s/v%s", author, name, version)
storage.write(ref, hash .. "\n")
end
function db.authors()
return db.nodes("refs/tags")
end
function db.names(author)
local prefix = "refs/tags/" .. author .. "/"
local stack = {db.nodes(prefix)}
return function ()
while true do
if #stack == 0 then return end
local name = stack[#stack]()
if name then
local path = stack[#stack - 1]
local newPath = path and path .. "/" .. name or name
stack[#stack + 1] = newPath
stack[#stack + 1] = db.nodes(prefix .. newPath)
return newPath
end
stack[#stack] = nil
stack[#stack] = nil
end
end
end
function db.versions(author, name)
local ref = string.format("refs/tags/%s/%s", author, name)
local iter = db.leaves(ref)
return function ()
local item = iter()
return item and item:sub(2)
end
end
local function keyPath(author, fingerprint)
return string.format("keys/%s/%s", author, fingerprint:gsub(":", "_"))
end
function db.readKey(author, fingerprint)
return storage.read(keyPath(author, fingerprint))
end
function db.putKey(author, fingerprint, key)
return storage.put(keyPath(author, fingerprint), key)
end
function db.revokeKey(author, fingerprint)
return storage.delete(keyPath(author, fingerprint))
end
function db.fingerprints(author)
local iter = storage.leaves("keys/" .. author)
return function ()
local item = iter()
return item and item:gsub("_", ":")
end
end
function db.getEtag(author)
return storage.read("keys/" .. author .. ".etag")
end
function db.setEtag(author, etag)
return storage.write("keys/" .. author .. ".etag", etag)
end
local function ownersPath(org)
return "keys/" .. org .. ".owners"
end
function db.owners(org)
local owners = storage.read(ownersPath(org))
if not owners then return end
return owners:gmatch("[^\n]+")
end
function db.isOwner(org, author)
local iter = db.owners(org)
if not iter then return false end
for owner in iter do
if author == owner then return true end
end
return false
end
function db.addOwner(org, author)
if db.isOwner(org, author) then return end
local path = ownersPath(org)
local owners = storage.read(path)
owners = (owners or "") .. author .. "\n"
storage.write(path, owners)
end
function db.removeOwner(org, author)
local list = {}
for owner in db.owners(org) do
if owner ~= author then
list[#list + 1] = owner
end
end
storage.write(ownersPath(org), table.concat(list, "\n") .. "\n")
end
function db.import(fs, path) --> kind, hash
return import(db, fs, path)
end
function db.export(hash, path) --> kind
return export(db, hash, gfs, path)
end
return db
end
| apache-2.0 |
mercury233/ygopro-scripts | c97729135.lua | 2 | 3652 | --にらみ合い
function c97729135.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--move
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(97729135,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(c97729135.mvcon1)
e2:SetTarget(c97729135.mvtg1)
e2:SetOperation(c97729135.mvop1)
c:RegisterEffect(e2)
--move
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(97729135,1))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetCondition(c97729135.mvcon2)
e3:SetTarget(c97729135.mvtg2)
e3:SetOperation(c97729135.mvop2)
c:RegisterEffect(e3)
end
function c97729135.cfilter(c,tp)
return c:IsSummonPlayer(tp) and c:GetSequence()>=5
end
function c97729135.mvcon1(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c97729135.cfilter,1,nil,tp)
end
function c97729135.mvfilter(c)
return c:GetSequence()<5
end
function c97729135.mvtg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local zone=0
local lg=eg:Filter(c97729135.cfilter,nil,tp)
for tc in aux.Next(lg) do
zone=bit.bor(zone,tc:GetColumnZone(LOCATION_MZONE,1-tp))
end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c97729135.mvfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c97729135.mvfilter,tp,0,LOCATION_MZONE,1,nil)
and Duel.GetLocationCount(1-tp,LOCATION_MZONE,PLAYER_NONE,0,zone)>0 end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(97729135,2))
Duel.SelectTarget(tp,c97729135.mvfilter,tp,0,LOCATION_MZONE,1,1,nil)
end
function c97729135.mvop1(e,tp,eg,ep,ev,re,r,rp)
local zone=0
local lg=eg:Filter(c97729135.cfilter,nil,tp)
for tc in aux.Next(lg) do
zone=bit.bor(zone,tc:GetColumnZone(LOCATION_MZONE,1-tp))
end
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) or tc:IsControler(tp)
or Duel.GetLocationCount(1-tp,LOCATION_MZONE,PLAYER_NONE,0,zone)<=0 then return end
local flag=bit.bxor(zone,0xff)*0x10000
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE)
local s=Duel.SelectDisableField(tp,1,0,LOCATION_MZONE,flag)/0x10000
local nseq=math.log(s,2)
Duel.MoveSequence(tc,nseq)
end
function c97729135.mvcon2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c97729135.cfilter,1,nil,1-tp)
end
function c97729135.mvtg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local zone=0
local lg=eg:Filter(c97729135.cfilter,nil,1-tp)
for tc in aux.Next(lg) do
zone=bit.bor(zone,tc:GetColumnZone(LOCATION_MZONE,tp))
end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c97729135.mvfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c97729135.mvfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.GetLocationCount(tp,LOCATION_MZONE,PLAYER_NONE,0,zone)>0 end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(97729135,2))
Duel.SelectTarget(tp,c97729135.mvfilter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c97729135.mvop2(e,tp,eg,ep,ev,re,r,rp)
local zone=0
local lg=eg:Filter(c97729135.cfilter,nil,1-tp)
for tc in aux.Next(lg) do
zone=bit.bor(zone,tc:GetColumnZone(LOCATION_MZONE,tp))
end
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) or tc:IsControler(1-tp)
or Duel.GetLocationCount(tp,LOCATION_MZONE,PLAYER_NONE,0,zone)<=0 then return end
local flag=bit.bxor(zone,0xff)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE)
local s=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,flag)
local nseq=math.log(s,2)
Duel.MoveSequence(tc,nseq)
end
| gpl-2.0 |
xin3liang/platform_external_chromium_org_third_party_skia | tools/lua/scrape_dashing.lua | 160 | 2495 | function tostr(t)
local str = ""
for k, v in next, t do
if #str > 0 then
str = str .. ", "
end
if type(k) == "number" then
str = str .. "[" .. k .. "] = "
else
str = str .. tostring(k) .. " = "
end
if type(v) == "table" then
str = str .. "{ " .. tostr(v) .. " }"
else
str = str .. tostring(v)
end
end
return str
end
local total_found = {} -- accumulate() stores its data in here
local total_total = {}
local canvas -- holds the current canvas (from startcanvas())
--[[
startcanvas() is called at the start of each picture file, passing the
canvas that we will be drawing into, and the name of the file.
Following this call, there will be some number of calls to accumulate(t)
where t is a table of parameters that were passed to that draw-op.
t.verb is a string holding the name of the draw-op (e.g. "drawRect")
when a given picture is done, we call endcanvas(canvas, fileName)
]]
function sk_scrape_startcanvas(c, fileName)
canvas = c
end
--[[
Called when the current canvas is done drawing.
]]
function sk_scrape_endcanvas(c, fileName)
canvas = nil
end
function increment(table, key)
table[key] = (table[key] or 0) + 1
end
local drawPointsTable = {}
local drawPointsTable_direction = {}
function sk_scrape_accumulate(t)
increment(total_total, t.verb)
local p = t.paint
if p then
local pe = p:getPathEffect();
if pe then
increment(total_found, t.verb)
end
end
if "drawPoints" == t.verb then
local points = t.points
increment(drawPointsTable, #points)
if 2 == #points then
if points[1].y == points[2].y then
increment(drawPointsTable_direction, "hori")
elseif points[1].x == points[2].x then
increment(drawPointsTable_direction, "vert")
else
increment(drawPointsTable_direction, "other")
end
end
end
end
--[[
lua_pictures will call this function after all of the pictures have been
"accumulated".
]]
function sk_scrape_summarize()
for k, v in next, total_found do
io.write(k, " = ", v, "/", total_total[k], "\n")
end
print("histogram of point-counts for all drawPoints calls")
print(tostr(drawPointsTable))
print(tostr(drawPointsTable_direction))
end
| bsd-3-clause |
blooblahguy/bdCore | lib/oUF/colors.lua | 2 | 8283 | local parent, ns = ...
local oUF = ns.oUF
local Private = oUF.Private
local frame_metatable = Private.frame_metatable
local colors = {
smooth = {
1, 0, 0,
1, 1, 0,
0, 1, 0
},
health = {49 / 255, 207 / 255, 37 / 255},
disconnected = {0.6, 0.6, 0.6},
tapped = {0.6, 0.6, 0.6},
runes = {
{247 / 255, 65 / 255, 57 / 255}, -- blood
{148 / 255, 203 / 255, 247 / 255}, -- frost
{173 / 255, 235 / 255, 66 / 255}, -- unholy
},
selection = {
[ 0] = {255 / 255, 0 / 255, 0 / 255}, -- HOSTILE
[ 1] = {255 / 255, 129 / 255, 0 / 255}, -- UNFRIENDLY
[ 2] = {255 / 255, 255 / 255, 0 / 255}, -- NEUTRAL
[ 3] = {0 / 255, 255 / 255, 0 / 255}, -- FRIENDLY
[ 4] = {0 / 255, 0 / 255, 255 / 255}, -- PLAYER_SIMPLE
[ 5] = {96 / 255, 96 / 255, 255 / 255}, -- PLAYER_EXTENDED
[ 6] = {170 / 255, 170 / 255, 255 / 255}, -- PARTY
[ 7] = {170 / 255, 255 / 255, 170 / 255}, -- PARTY_PVP
[ 8] = {83 / 255, 201 / 255, 255 / 255}, -- FRIEND
[ 9] = {128 / 255, 128 / 255, 128 / 255}, -- DEAD
-- [10] = {}, -- COMMENTATOR_TEAM_1, unavailable to players
-- [11] = {}, -- COMMENTATOR_TEAM_2, unavailable to players
[12] = {255 / 255, 255 / 255, 139 / 255}, -- SELF, buggy
[13] = {0 / 255, 153 / 255, 0 / 255}, -- BATTLEGROUND_FRIENDLY_PVP
},
class = {},
debuff = {},
reaction = {},
power = {},
}
-- We do this because people edit the vars directly, and changing the default
-- globals makes SPICE FLOW!
local function customClassColors()
if(CUSTOM_CLASS_COLORS) then
local function updateColors()
for classToken, color in next, CUSTOM_CLASS_COLORS do
colors.class[classToken] = {color.r, color.g, color.b}
end
for _, obj in next, oUF.objects do
obj:UpdateAllElements('CUSTOM_CLASS_COLORS')
end
end
updateColors()
CUSTOM_CLASS_COLORS:RegisterCallback(updateColors)
return true
end
end
if(not customClassColors()) then
for classToken, color in next, RAID_CLASS_COLORS do
colors.class[classToken] = {color.r, color.g, color.b}
end
local eventHandler = CreateFrame('Frame')
eventHandler:RegisterEvent('ADDON_LOADED')
eventHandler:SetScript('OnEvent', function(self)
if(customClassColors()) then
self:UnregisterEvent('ADDON_LOADED')
self:SetScript('OnEvent', nil)
end
end)
end
for debuffType, color in next, DebuffTypeColor do
colors.debuff[debuffType] = {color.r, color.g, color.b}
end
for eclass, color in next, FACTION_BAR_COLORS do
colors.reaction[eclass] = {color.r, color.g, color.b}
end
for power, color in next, PowerBarColor do
if (type(power) == 'string') then
if(type(select(2, next(color))) == 'table') then
colors.power[power] = {}
for index, color in next, color do
colors.power[power][index] = {color.r, color.g, color.b}
end
else
colors.power[power] = {color.r, color.g, color.b, atlas = color.atlas}
end
end
end
-- sourced from FrameXML/Constants.lua
colors.power[0] = colors.power.MANA
colors.power[1] = colors.power.RAGE
colors.power[2] = colors.power.FOCUS
colors.power[3] = colors.power.ENERGY
colors.power[4] = colors.power.COMBO_POINTS
colors.power[5] = colors.power.RUNES
colors.power[6] = colors.power.RUNIC_POWER
colors.power[7] = colors.power.SOUL_SHARDS
colors.power[8] = colors.power.LUNAR_POWER
colors.power[9] = colors.power.HOLY_POWER
colors.power[11] = colors.power.MAELSTROM
colors.power[12] = colors.power.CHI
colors.power[13] = colors.power.INSANITY
colors.power[16] = colors.power.ARCANE_CHARGES
colors.power[17] = colors.power.FURY
colors.power[18] = colors.power.PAIN
local function colorsAndPercent(a, b, ...)
if(a <= 0 or b == 0) then
return nil, ...
elseif(a >= b) then
return nil, select(-3, ...)
end
local num = select('#', ...) / 3
local segment, relperc = math.modf((a / b) * (num - 1))
return relperc, select((segment * 3) + 1, ...)
end
-- http://www.wowwiki.com/ColorGradient
--[[ Colors: oUF:RGBColorGradient(a, b, ...)
Used to convert a percent value (the quotient of `a` and `b`) into a gradient from 2 or more RGB colors. If more than 2
colors are passed, the gradient will be between the two colors which perc lies in an evenly divided range. A RGB color
is a sequence of 3 consecutive RGB percent values (in the range [0-1]). If `a` is negative or `b` is zero then the first
RGB color (the first 3 RGB values passed to the function) is returned. If `a` is bigger than or equal to `b`, then the
last 3 RGB values are returned.
* self - the global oUF object
* a - value used as numerator to calculate the percentage (number)
* b - value used as denominator to calculate the percentage (number)
* ... - a list of RGB percent values. At least 6 values should be passed (number [0-1])
--]]
function oUF:RGBColorGradient(...)
local relperc, r1, g1, b1, r2, g2, b2 = colorsAndPercent(...)
if(relperc) then
return r1 + (r2 - r1) * relperc, g1 + (g2 - g1) * relperc, b1 + (b2 - b1) * relperc
else
return r1, g1, b1
end
end
-- HCY functions are based on http://www.chilliant.com/rgb2hsv.html
local function getY(r, g, b)
return 0.299 * r + 0.587 * g + 0.114 * b
end
local function rgbToHCY(r, g, b)
local min, max = math.min(r, g, b), math.max(r, g, b)
local chroma = max - min
local hue
if(chroma > 0) then
if(r == max) then
hue = ((g - b) / chroma) % 6
elseif(g == max) then
hue = (b - r) / chroma + 2
elseif(b == max) then
hue = (r - g) / chroma + 4
end
hue = hue / 6
end
return hue, chroma, getY(r, g, b)
end
local function hcyToRGB(hue, chroma, luma)
local r, g, b = 0, 0, 0
if(hue and luma > 0) then
local h2 = hue * 6
local x = chroma * (1 - math.abs(h2 % 2 - 1))
if(h2 < 1) then
r, g, b = chroma, x, 0
elseif(h2 < 2) then
r, g, b = x, chroma, 0
elseif(h2 < 3) then
r, g, b = 0, chroma, x
elseif(h2 < 4) then
r, g, b = 0, x, chroma
elseif(h2 < 5) then
r, g, b = x, 0, chroma
else
r, g, b = chroma, 0, x
end
local y = getY(r, g, b)
if(luma < y) then
chroma = chroma * (luma / y)
elseif(y < 1) then
chroma = chroma * (1 - luma) / (1 - y)
end
r = (r - y) * chroma + luma
g = (g - y) * chroma + luma
b = (b - y) * chroma + luma
end
return r, g, b
end
--[[ Colors: oUF:HCYColorGradient(a, b, ...)
Used to convert a percent value (the quotient of `a` and `b`) into a gradient from 2 or more HCY colors. If more than 2
colors are passed, the gradient will be between the two colors which perc lies in an evenly divided range. A HCY color
is a sequence of 3 consecutive values in the range [0-1]. If `a` is negative or `b` is zero then the first
HCY color (the first 3 HCY values passed to the function) is returned. If `a` is bigger than or equal to `b`, then the
last 3 HCY values are returned.
* self - the global oUF object
* a - value used as numerator to calculate the percentage (number)
* b - value used as denominator to calculate the percentage (number)
* ... - a list of HCY color values. At least 6 values should be passed (number [0-1])
--]]
function oUF:HCYColorGradient(...)
local relperc, r1, g1, b1, r2, g2, b2 = colorsAndPercent(...)
if(not relperc) then
return r1, g1, b1
end
local h1, c1, y1 = rgbToHCY(r1, g1, b1)
local h2, c2, y2 = rgbToHCY(r2, g2, b2)
local c = c1 + (c2 - c1) * relperc
local y = y1 + (y2 - y1) * relperc
if(h1 and h2) then
local dh = h2 - h1
if(dh < -0.5) then
dh = dh + 1
elseif(dh > 0.5) then
dh = dh - 1
end
return hcyToRGB((h1 + dh * relperc) % 1, c, y)
else
return hcyToRGB(h1 or h2, c, y)
end
end
--[[ Colors: oUF:ColorGradient(a, b, ...) or frame:ColorGradient(a, b, ...)
Used as a proxy to call the proper gradient function depending on the user's preference. If `oUF.useHCYColorGradient` is
set to true, `:HCYColorGradient` will be called, else `:RGBColorGradient`.
* self - the global oUF object or a unit frame
* a - value used as numerator to calculate the percentage (number)
* b - value used as denominator to calculate the percentage (number)
* ... - a list of color values. At least 6 values should be passed (number [0-1])
--]]
function oUF:ColorGradient(...)
return (oUF.useHCYColorGradient and oUF.HCYColorGradient or oUF.RGBColorGradient)(self, ...)
end
oUF.colors = colors
oUF.useHCYColorGradient = false
frame_metatable.__index.colors = colors
frame_metatable.__index.ColorGradient = oUF.ColorGradient
| gpl-3.0 |
mercury233/ygopro-scripts | c42280216.lua | 6 | 1690 | --太陽の神官
function c42280216.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c42280216.spcon)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(42280216,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c42280216.shcon)
e2:SetTarget(c42280216.shtg)
e2:SetOperation(c42280216.shop)
c:RegisterEffect(e2)
end
function c42280216.spcon(e,c)
if c==nil then return true end
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0,nil)==0
and Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE,nil)>0
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c42280216.shcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsReason(REASON_DESTROY)
end
function c42280216.filter(c)
return c:IsCode(78275321,78552773) and c:IsAbleToHand()
end
function c42280216.shtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c42280216.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c42280216.shop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c42280216.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
| gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.