Hello!
I am planning to program a Yu-Gi-Oh! card game for Windows Operating System. See this link for more info about Yu-Gi-Oh!: http://en.wikipedia.org/wiki/Yu-Gi-Oh!_Trading_Card_Game
I'd like to start with the game YGOPRO. See this link about the game: http://ygopro.co. I have the game installed on my PC and enjoys playing it! I'm really trying to learn how the game was programmed by checking each files from the game source, viewing them on a text editor, so on...
Starting with card scripting.
Images of the game:
The card's database, where the names and information of the cards are saved, and their scripts, the actions performed based on the card's description when it's triggered. I don't have an idea how they were executed and performed when the cards are used within the game.
I picked up a card to be an example named The Gates of Dark World.
Here's the file and image for the card's database (cards.cdb): https://www.dropbox.com/s/2uow819ay7zl11g/cards.cdb?dl=0
Within the game:
File for the card's scripts (c33017655.lua): https://www.dropbox.com/s/4nru2mtufe9c75f/c33017655.lua?dl=0
--?????
function c33017655.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_FIEND))
e2:SetValue(300)
c:RegisterEffect(e2)
--defup
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_UPDATE_DEFENCE)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_FIEND))
e3:SetValue(300)
c:RegisterEffect(e3)
--discard & draw
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_HANDES+CATEGORY_DRAW)
e4:SetDescription(aux.Stringid(33017655,1))
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1)
e4:SetCost(c33017655.cost)
e4:SetTarget(c33017655.target)
e4:SetOperation(c33017655.operation)
c:RegisterEffect(e4)
end
function c33017655.costfilter(c)
return c:IsRace(RACE_FIEND) and c:IsAbleToRemoveAsCost()
end
function c33017655.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c33017655.costfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c33017655.costfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c33017655.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsRace,tp,LOCATION_HAND,0,1,nil,RACE_FIEND)
and Duel.IsPlayerCanDraw(tp,1) end
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c33017655.operation(e,tp,eg,ep,ev,re,r,rp,chk)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,Card.IsRace,tp,LOCATION_HAND,0,1,1,nil,RACE_FIEND)
if g:GetCount()>0 then
Duel.SendtoGrave(g,REASON_EFFECT+REASON_DISCARD)
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
Here are the other files from the game source:
(lflist.conf) - https://www.dropbox.com/s/ivdbyy11ql5vg17/lflist.conf?dl=0
(strings.conf) - https://www.dropbox.com/s/bcl7ymeyf8hy33k/strings.conf?dl=0
(system.conf) - https://www.dropbox.com/s/er3ay621jvn0qrn/system.conf?dl=0
I want to know how the two files work; the cads.cdb & c33017655.lua
And what programming language is a .lua file?!
Anyone who knows?
I need more explanations!
Thanks ~ !