Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Math = {}
- local Pokemon = require(game.ReplicatedStorage.Information.Pokemon)
- function Math:PokeChange(newPos)
- game.ReplicatedStorage.REvents.Pokemon.ChangePokecenter:FireServer(newPos)
- end
- --function Math:hange(instance, newvalue,type)
- -- if instance.Name ~= "Money" then
- --game.ReplicatedStorage.REvents.Internal.cfc:FireServer(instance, newvalue,"hljR7cgGQIzK0Y4d4ECrhljR7cgGQIzK0Y4d4ECr")
- -- else
- --game.ReplicatedStorage.REvents.Internal.zxz:FireServer(instance, newvalue)
- -- end
- --instance.Value = newvalue
- --end
- function Math:StatusChange(Pokemon,newStatus)
- Pokemon.Status.Value = newStatus
- game.ReplicatedStorage.REvents.Pokemon.StatusChange:FireServer(Pokemon,newStatus)
- end
- function Math:RequestChange(Instan,newVal)
- Instan.Value = newVal
- game.ReplicatedStorage.REvents.Pokemon.changeRequests:FireServer(Instan,newVal)
- end
- function Math:BuyItem(instance, newvalue,type)
- local buying = game.ReplicatedStorage.REvents.Internal.funcItem:InvokeServer(instance, newvalue)
- return buying
- end
- ItemMod = require(game.ReplicatedStorage.Information.Items)
- function Math:HealItem(Pokemon,Item)
- local ItemStats = ItemMod[Item]
- local ItemRecover = ItemStats["Use"]["Heal"]
- Pokemon.CurrentHP.Value = math.min(Pokemon.CurrentHP.Value+ItemRecover,Pokemon.Stats.HPStat.Value)
- --game.ReplicatedStorage.REvents.Pokemon.HealItem:FireServer(Pokemon,Item)
- end
- function Math:NatureChange(Pokemon)
- game.ReplicatedStorage.REvents.Pokemon.NatureChange:InvokeServer(Pokemon)
- end
- function Math:EVChange(Pokemon,Item)
- game.ReplicatedStorage.REvents.Pokemon.MinusEVs:InvokeServer(Pokemon,Item)
- end
- function Math:ShopBuy(Item,Amount)
- local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.Compare:InvokeServer(Item,Amount)
- return outcome, moneyLeft
- end
- function Math:AddItem(item,itemParent,number)
- local d = game.ReplicatedStorage.REvents.Pokemon.ozAxZ:InvokeServer(item,itemParent,number)
- return d
- end
- function Math:AddBoolItem(item,itemParent)
- local d = game.ReplicatedStorage.REvents.Battle.AddBoolItem:InvokeServer(item,itemParent)
- end
- function Math:FuncAddItem(item,itemParent,number)
- local d = game.ReplicatedStorage.REvents.Pokemon.ozAxZ:InvokeServer(item,itemParent,number)
- return d
- end
- function Math:HealPokemon(Pokemon,value2)
- Pokemon.CurrentHP.Value = value2
- game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"HealBattle",value2)
- end
- function Math:NeoPill(Pokemon)
- game.ReplicatedStorage.REvents.Pokemon.NeoPill:InvokeServer(Pokemon)
- end
- function Math:EVChanger(stat,newVal)
- game.ReplicatedStorage.REvents.Pokemon.EVChange:InvokeServer(stat,newVal)
- end
- function Math:PokeBuy(item,money)
- local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.PokeBuy:InvokeServer(item, money)
- return outcome, moneyLeft
- end
- function Math:TMBuy(Item,Amount)
- local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.TMBuy:InvokeServer(Item,Amount)
- return outcome, moneyLeft
- end
- function Math:Check(Instance,hash)
- if hash == nil or hash == false then
- Instance.Value = Instance.Value - 1
- else
- Instance.Value = Instance.Value - 8
- end
- game.ReplicatedStorage.REvents.Internal.mathCheck:FireServer(Instance,hash)
- end
- function Math:PropChange(instance, prop, nVal)
- instance.Name = nVal
- local d = game.ReplicatedStorage.REvents.Internal.changeProp:FireServer(instance,prop,nVal)
- end
- function Math:Vitamins(Pokemon,Vitamin)
- game.ReplicatedStorage.REvents.Pokemon.Vitamins:InvokeServer(Pokemon,Vitamin)
- end
- function Math:BPChange(BPamount)
- game.ReplicatedStorage.REvents.Pokemon.GreenPill:InvokeServer(BPamount)
- end
- function Math:ParentChange(instance, newParent)
- local d = game.ReplicatedStorage.REvents.Internal.changeParent:FireServer(instance,newParent)
- instance.Parent = newParent
- end
- function Math:TMLearn(Pokemon,moveGettingReplaced,TM)
- game.ReplicatedStorage.REvents.Pokemon.TMLearn:InvokeServer(Pokemon,moveGettingReplaced,TM)
- end
- function Math:AwardBadge(number)
- game.ReplicatedStorage.REvents.Internal.AwardBadge:FireServer(tostring(number))
- end
- function Math:Rest(Pokemon)
- Pokemon.CurrentHP.Value = Pokemon.Stats.HPStat.Value
- Pokemon.Status.Value = "Sleep"
- game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"Rest")
- end
- function Math:PainSplit(Pokemon,Value2)
- Pokemon.CurrentHP.Value = Value2
- game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"PainSplit",Value2)
- end
- function Math:HealBattle(Pokemon,newVal)
- Pokemon.CurrentHP.Value = newVal
- game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"HealBattle",newVal)
- end
- function Math:AbilityRecover(Pokemon)
- Pokemon.CurrentHP.Value = math.min(Pokemon.Stats.HPStat.Value,Pokemon.CurrentHP.Value+(Pokemon.Stats.HPStat.Value/4))
- game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"AbilityRecover")
- end
- function Math:Faint(Pokemon)
- Pokemon.CurrentHP.Value = 0
- Pokemon.Status.Value = "Faint"
- game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"Faint")
- end
- function Math:BuyBooster(typeo,minutes)
- local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.BuyBooster:InvokeServer(typeo,minutes)
- return outcome, moneyLeft
- end
- function Math:BPCheck(Item,Amount)
- local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.BPCheck:InvokeServer(Item,Amount)
- return outcome, moneyLeft
- end
- function Math:MoveLearn(Pokemon,Replace,newMove)
- game.ReplicatedStorage.REvents.Pokemon.MoveLearn:InvokeServer(Pokemon,Replace,newMove)
- end
- function Math:MoveRelearner(Pokemon,Replace,newMove)
- game.ReplicatedStorage.REvents.Pokemon.MoveRelearner:InvokeServer(Pokemon,Replace,newMove)
- end
- function Math:Entity(Color)
- return game.ReplicatedStorage.REvents.Pokemon.Entity:InvokeServer(Color)
- end
- function Math:BPTM(Item,Amount)
- local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.BPTM:InvokeServer(Item,Amount)
- return outcome, moneyLeft
- end
- --
- --function Math:CheckLegit(Instance)
- -- game.ReplicatedStorage.REvents.Internal.CheckLegit:FireServer(Instance)
- --end
- local stats = {"Atk","Def","SpA","SpD","Speed"}
- local nstats = { --Boost = 110% (1.1), Down = 90% (.9)
- ["Neutral"] = {["Hardy"] = true,["Docile"] = true,["Serious"] = true,["Bashful"] = true ,["Quirky"] = true},
- ["Atk Boost"] = {["Lonely"] = true,["Brave"] = true,["Adamant"] = true,["Naughty"] = true},
- ["Atk Down"] = {["Bold"] = true,["Timid"] = true,["Modest"] = true,["Calm"] = true},
- ["Def Boost"] = {["Bold"] = true,["Relaxed"]= true,["Impish"]= true,["Lax"]= true},
- ["Def Down"] = {["Lonely"]= true,["Hasty"]= true,["Mild"]= true,["Gentle"]= true},
- ["Speed Boost"] = {["Timid"]= true,["Hasty"]= true,["Jolly"]= true,["Naive"]= true},
- ["Speed Down"] = {["Brave"]= true,["Relaxed"] = true,["Quiet"] = true,["Sassy"] = true},
- ["SpA Boost"] = {["Modest"]= true,["Mild"] = true,["Quiet"] = true,["Rash"] = true},
- ["SpA Down"] = {["Adamant"]= true,["Impish"]= true,["Jolly"]= true,["Careful"] = true},
- ["SpD Boost"] = {["Calm"]= true,["Gentle"]= true,["Sassy"]= true,["Careful"]= true},
- ["SpD Down"] = {["Naughty"]= true,["Lax"]= true,["Naive"]= true,["Rash"]= true}
- }
- function determinenature(stat,nature)
- if nstats[stat.." Boost"][nature] then
- return 1.1
- elseif nstats[stat.." Down"][nature] then
- return .9
- else return 1
- end
- end
- function HPcalc(poke)
- return ((
- poke.IV.HPIV.Value+ 2* _G.Pokemon[poke.Name]["Stats"]["HP"] +(poke.EV.HPEV.Value/4))*poke.Lvl.Value/100)+10+poke.Lvl.Value
- end
- function otherstatcalc(poke,basestat)
- return (((poke.IV[basestat.."IV"].Value+2*_G.Pokemon[poke.Name]["Stats"][basestat]+(poke.EV[basestat.."EV"].Value/4))*poke.Lvl.Value/100)+5) * determinenature(basestat,poke.Nature.Value)
- end
- function recalcStats(Pokemon)
- local hpBefore = Pokemon.Stats.HPStat.Value
- local newStat = HPcalc(Pokemon)
- local plus = newStat - hpBefore
- Pokemon.Stats.HPStat.Value = newStat
- if Pokemon.Status.Value ~= "Faint" then
- Pokemon.CurrentHP.Value = math.min(newStat,Pokemon.CurrentHP.Value+plus)
- end
- for _,basestat in ipairs(stats) do
- Pokemon.Stats[basestat.."Stat"].Value = otherstatcalc(Pokemon,basestat)
- end
- end
- function Math:StatChange(Pokemon)
- recalcStats(Pokemon)
- if _G.Pokemon[Pokemon.Name]["Mega"] == nil then
- game.ReplicatedStorage.REvents.Pokemon.StatChange:FireServer(Pokemon)
- end
- end
- function Math:Oak(value)
- game.ReplicatedStorage.REvents.Pokemon.Oak:InvokeServer(value)
- end
- function Math:DeoxysChange(Pokemon,newPokemon)
- game.ReplicatedStorage.REvents.Pokemon.DeoxysChange:InvokeServer(Pokemon,newPokemon)
- end
- function Math:RotomChange(Pokemon,newPokemon,newMove)
- game.ReplicatedStorage.REvents.Pokemon.RotomChange:InvokeServer(Pokemon,newPokemon,newMove)
- end
- function Math:GiratinaChange(Pokemon,newPokemon)
- game.ReplicatedStorage.REvents.Pokemon.GiratinaChange:InvokeServer(Pokemon,newPokemon)
- end
- function Math:IVChange(Pokemon)
- return game.ReplicatedStorage.REvents.Pokemon.IVChange:InvokeServer(Pokemon)
- end
- function Math:Revive(Pokemon)
- Pokemon.Status.Value = ""
- Pokemon.CurrentHP.Value = math.floor(Pokemon.Stats.HPStat.Value/2)
- game.ReplicatedStorage.REvents.Pokemon.RevivePokemon:FireServer(Pokemon)
- end
- function Math:Caughter(pokemon,pokeball)
- game.ReplicatedStorage.REvents.Pokemon.Caughter:InvokeServer(pokemon,pokeball)
- end
- function Math:PPUse(val,pressure)
- val.Value = val.Value - 1
- game.ReplicatedStorage.REvents.Pokemon.UsePP:FireServer(val,pressure)
- end
- function Math:ResetLevel(Pokemon)
- game.ReplicatedStorage.REvents.Pokemon.ResetLevel:InvokeServer(Pokemon)
- end
- function Math:FixMoves(Pokemon)
- game.ReplicatedStorage.REvents.Pokemon.FixMoves:InvokeServer(Pokemon)
- end
- function Math:ResetEV(Pokemon)
- game.ReplicatedStorage.REvents.Pokemon.ResetEV:InvokeServer(Pokemon)
- end
- function Math:EVChange(Pokemon,Item)
- game.ReplicatedStorage.REvents.Pokemon.ChangeEVs:InvokeServer(Pokemon,Item)
- end
- function Math:NatureScientist(Pokemon,FinalNature)
- game.ReplicatedStorage.REvents.Pokemon.NatureScientist:InvokeServer(Pokemon,FinalNature)
- end
- function Math:TakeDamage(Pokemon,NewHealth)
- if Pokemon.CurrentHP.Value >= NewHealth or NewHealth == 1 then
- Pokemon.CurrentHP.Value = NewHealth
- game.ReplicatedStorage.REvents.Pokemon.TakeDamage:FireServer(Pokemon,NewHealth)
- end
- end
- function Math:SetExp(Pokemon)
- game.ReplicatedStorage.REvents.Pokemon.SetExperienceToLevel:InvokeServer(Pokemon)
- return
- end
- function Math:MaxElixir(Pokemon)
- for i,v in pairs(Pokemon.Moves:GetChildren()) do
- v.PP.Value = _G.Moves[v.Name]["PP"]
- end
- game.ReplicatedStorage.REvents.Pokemon.MaxElixir:FireServer(Pokemon)
- end
- function Math:LevelDown(Pokemon)
- game.ReplicatedStorage.REvents.Pokemon.RedPill:InvokeServer(Pokemon)
- end
- function Math:LevelUp(Pokemon)
- game.ReplicatedStorage.REvents.Pokemon.BluePill:InvokeServer(Pokemon)
- return
- end
- function Math:SwapPC(Pokemon,newPos)
- -- game.ReplicatedStorage.REvents.Pokemon.SwapPC:FireServer(Pokemon,newPos)
- Pokemon.PartyPosition.Value = newPos
- end
- Math.Debounce = false
- function Math:SwapParty(Pokemon,newPos)
- Math.Debounce = true
- game.ReplicatedStorage.REvents.Pokemon.SwapParty:InvokeServer(Pokemon,newPos)
- Math.Debounce = false
- --Pokemon.PartyPosition.Value = newPos
- end
- return Math
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement