Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.26 KB | None | 0 0
  1.  
  2. local Math = {}
  3. local Pokemon = require(game.ReplicatedStorage.Information.Pokemon)
  4.  
  5. function Math:PokeChange(newPos)
  6.     game.ReplicatedStorage.REvents.Pokemon.ChangePokecenter:FireServer(newPos)
  7. end
  8.  
  9. --function Math:hange(instance, newvalue,type)
  10. --  if instance.Name ~= "Money"  then
  11. --game.ReplicatedStorage.REvents.Internal.cfc:FireServer(instance, newvalue,"hljR7cgGQIzK0Y4d4ECrhljR7cgGQIzK0Y4d4ECr")
  12. --  else
  13. --game.ReplicatedStorage.REvents.Internal.zxz:FireServer(instance, newvalue)
  14. --  end
  15. --instance.Value = newvalue
  16. --end
  17.  
  18.  
  19.  
  20. function Math:StatusChange(Pokemon,newStatus)
  21.     Pokemon.Status.Value = newStatus
  22.     game.ReplicatedStorage.REvents.Pokemon.StatusChange:FireServer(Pokemon,newStatus)
  23. end
  24.  
  25. function Math:RequestChange(Instan,newVal)
  26.     Instan.Value = newVal
  27.     game.ReplicatedStorage.REvents.Pokemon.changeRequests:FireServer(Instan,newVal)
  28.    
  29. end
  30. function Math:BuyItem(instance, newvalue,type)
  31. local buying = game.ReplicatedStorage.REvents.Internal.funcItem:InvokeServer(instance, newvalue)
  32. return buying
  33. end
  34.  
  35. ItemMod = require(game.ReplicatedStorage.Information.Items)
  36.  
  37. function Math:HealItem(Pokemon,Item)
  38.     local ItemStats = ItemMod[Item]
  39.     local ItemRecover = ItemStats["Use"]["Heal"]
  40.     Pokemon.CurrentHP.Value = math.min(Pokemon.CurrentHP.Value+ItemRecover,Pokemon.Stats.HPStat.Value)
  41.     --game.ReplicatedStorage.REvents.Pokemon.HealItem:FireServer(Pokemon,Item)
  42.    
  43. end
  44. function Math:NatureChange(Pokemon)
  45.     game.ReplicatedStorage.REvents.Pokemon.NatureChange:InvokeServer(Pokemon)
  46. end
  47.  
  48. function Math:EVChange(Pokemon,Item)
  49.     game.ReplicatedStorage.REvents.Pokemon.MinusEVs:InvokeServer(Pokemon,Item)
  50. end
  51. function Math:ShopBuy(Item,Amount)
  52.     local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.Compare:InvokeServer(Item,Amount)
  53.     return outcome, moneyLeft
  54. end
  55.  
  56. function Math:AddItem(item,itemParent,number)
  57.     local d = game.ReplicatedStorage.REvents.Pokemon.ozAxZ:InvokeServer(item,itemParent,number)
  58.     return d
  59. end
  60.  
  61. function Math:AddBoolItem(item,itemParent)
  62.     local d = game.ReplicatedStorage.REvents.Battle.AddBoolItem:InvokeServer(item,itemParent)
  63. end
  64. function Math:FuncAddItem(item,itemParent,number)
  65.     local d = game.ReplicatedStorage.REvents.Pokemon.ozAxZ:InvokeServer(item,itemParent,number)
  66.     return d
  67. end
  68.  
  69. function Math:HealPokemon(Pokemon,value2)
  70.     Pokemon.CurrentHP.Value = value2
  71.     game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"HealBattle",value2)
  72.    
  73. end
  74.  
  75. function Math:NeoPill(Pokemon)
  76.     game.ReplicatedStorage.REvents.Pokemon.NeoPill:InvokeServer(Pokemon)
  77. end
  78.  
  79. function Math:EVChanger(stat,newVal)
  80.     game.ReplicatedStorage.REvents.Pokemon.EVChange:InvokeServer(stat,newVal)
  81. end
  82.  
  83. function Math:PokeBuy(item,money)
  84.     local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.PokeBuy:InvokeServer(item, money)
  85.     return outcome, moneyLeft
  86. end
  87.  
  88. function Math:TMBuy(Item,Amount)
  89. local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.TMBuy:InvokeServer(Item,Amount)
  90.     return outcome, moneyLeft
  91. end
  92.  
  93. function Math:Check(Instance,hash)
  94.     if hash == nil or hash == false then
  95.     Instance.Value = Instance.Value - 1
  96.     else
  97.         Instance.Value = Instance.Value - 8
  98.     end
  99.     game.ReplicatedStorage.REvents.Internal.mathCheck:FireServer(Instance,hash)
  100.  
  101. end
  102.  
  103. function Math:PropChange(instance, prop, nVal)
  104.     instance.Name = nVal
  105.     local d = game.ReplicatedStorage.REvents.Internal.changeProp:FireServer(instance,prop,nVal)
  106. end
  107.  
  108. function Math:Vitamins(Pokemon,Vitamin)
  109.     game.ReplicatedStorage.REvents.Pokemon.Vitamins:InvokeServer(Pokemon,Vitamin)
  110.    
  111. end
  112.  
  113. function Math:BPChange(BPamount)
  114.     game.ReplicatedStorage.REvents.Pokemon.GreenPill:InvokeServer(BPamount)
  115. end
  116. function Math:ParentChange(instance, newParent)
  117.     local d = game.ReplicatedStorage.REvents.Internal.changeParent:FireServer(instance,newParent)
  118.     instance.Parent = newParent
  119. end
  120.  
  121. function Math:TMLearn(Pokemon,moveGettingReplaced,TM)
  122.     game.ReplicatedStorage.REvents.Pokemon.TMLearn:InvokeServer(Pokemon,moveGettingReplaced,TM)
  123. end
  124. function Math:AwardBadge(number)
  125.     game.ReplicatedStorage.REvents.Internal.AwardBadge:FireServer(tostring(number))
  126. end
  127.  
  128. function Math:Rest(Pokemon)
  129.     Pokemon.CurrentHP.Value = Pokemon.Stats.HPStat.Value
  130.     Pokemon.Status.Value = "Sleep"
  131.     game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"Rest")
  132. end
  133.  
  134. function Math:PainSplit(Pokemon,Value2)
  135.     Pokemon.CurrentHP.Value = Value2
  136.     game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"PainSplit",Value2)
  137. end
  138.  
  139. function Math:HealBattle(Pokemon,newVal)
  140.     Pokemon.CurrentHP.Value = newVal
  141.     game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"HealBattle",newVal)
  142. end
  143. function Math:AbilityRecover(Pokemon)
  144.     Pokemon.CurrentHP.Value = math.min(Pokemon.Stats.HPStat.Value,Pokemon.CurrentHP.Value+(Pokemon.Stats.HPStat.Value/4))
  145.     game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"AbilityRecover")
  146. end
  147. function Math:Faint(Pokemon)
  148.     Pokemon.CurrentHP.Value = 0
  149.     Pokemon.Status.Value = "Faint"
  150.     game.ReplicatedStorage.REvents.Pokemon.PokemonMoveFunc:FireServer(Pokemon,"Faint")
  151. end
  152. function Math:BuyBooster(typeo,minutes)
  153.     local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.BuyBooster:InvokeServer(typeo,minutes)
  154.     return outcome, moneyLeft
  155. end
  156.  
  157. function Math:BPCheck(Item,Amount)
  158.     local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.BPCheck:InvokeServer(Item,Amount)
  159.     return outcome, moneyLeft
  160. end
  161.  
  162. function Math:MoveLearn(Pokemon,Replace,newMove)
  163.     game.ReplicatedStorage.REvents.Pokemon.MoveLearn:InvokeServer(Pokemon,Replace,newMove)
  164. end
  165. function Math:MoveRelearner(Pokemon,Replace,newMove)
  166.     game.ReplicatedStorage.REvents.Pokemon.MoveRelearner:InvokeServer(Pokemon,Replace,newMove)
  167. end
  168.  
  169. function Math:Entity(Color)
  170.     return game.ReplicatedStorage.REvents.Pokemon.Entity:InvokeServer(Color)
  171. end
  172. function Math:BPTM(Item,Amount)
  173.     local outcome, moneyLeft = game.ReplicatedStorage.REvents.Internal.BPTM:InvokeServer(Item,Amount)
  174.     return outcome, moneyLeft
  175. end
  176. --
  177. --function Math:CheckLegit(Instance)
  178. --  game.ReplicatedStorage.REvents.Internal.CheckLegit:FireServer(Instance)
  179. --end
  180. local stats = {"Atk","Def","SpA","SpD","Speed"}
  181. local nstats = { --Boost = 110% (1.1), Down = 90% (.9)
  182.     ["Neutral"] = {["Hardy"] = true,["Docile"] = true,["Serious"] = true,["Bashful"] = true ,["Quirky"] = true},
  183.     ["Atk Boost"] = {["Lonely"] = true,["Brave"] = true,["Adamant"] = true,["Naughty"] = true},
  184.     ["Atk Down"] = {["Bold"] = true,["Timid"] = true,["Modest"] = true,["Calm"] = true},
  185.     ["Def Boost"] = {["Bold"] = true,["Relaxed"]= true,["Impish"]= true,["Lax"]= true},
  186.     ["Def Down"] = {["Lonely"]= true,["Hasty"]= true,["Mild"]= true,["Gentle"]= true},
  187.     ["Speed Boost"] = {["Timid"]= true,["Hasty"]= true,["Jolly"]= true,["Naive"]= true},
  188.     ["Speed Down"] = {["Brave"]= true,["Relaxed"] = true,["Quiet"] = true,["Sassy"] = true},
  189.     ["SpA Boost"] = {["Modest"]= true,["Mild"] = true,["Quiet"] = true,["Rash"] = true},
  190.     ["SpA Down"] = {["Adamant"]= true,["Impish"]= true,["Jolly"]= true,["Careful"] = true},
  191.     ["SpD Boost"] = {["Calm"]= true,["Gentle"]= true,["Sassy"]= true,["Careful"]= true},
  192.     ["SpD Down"] = {["Naughty"]= true,["Lax"]= true,["Naive"]= true,["Rash"]= true}
  193. }
  194.  
  195. function determinenature(stat,nature)
  196.     if nstats[stat.." Boost"][nature] then
  197.         return 1.1
  198.     elseif nstats[stat.." Down"][nature] then
  199.         return .9
  200.     else return 1
  201.     end
  202. end
  203. function HPcalc(poke)
  204.     return ((
  205.         poke.IV.HPIV.Value+ 2* _G.Pokemon[poke.Name]["Stats"]["HP"] +(poke.EV.HPEV.Value/4))*poke.Lvl.Value/100)+10+poke.Lvl.Value
  206. end
  207.  
  208. function otherstatcalc(poke,basestat)
  209.     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)
  210. end
  211.  
  212. function recalcStats(Pokemon)
  213.     local hpBefore = Pokemon.Stats.HPStat.Value
  214.     local newStat = HPcalc(Pokemon)
  215.     local plus = newStat - hpBefore
  216.     Pokemon.Stats.HPStat.Value = newStat
  217.     if Pokemon.Status.Value ~= "Faint" then
  218.     Pokemon.CurrentHP.Value = math.min(newStat,Pokemon.CurrentHP.Value+plus)
  219.     end
  220.     for _,basestat in ipairs(stats) do
  221.  
  222.         Pokemon.Stats[basestat.."Stat"].Value = otherstatcalc(Pokemon,basestat)
  223.     end
  224. end
  225. function Math:StatChange(Pokemon)
  226.     recalcStats(Pokemon)
  227.     if _G.Pokemon[Pokemon.Name]["Mega"] == nil then
  228.     game.ReplicatedStorage.REvents.Pokemon.StatChange:FireServer(Pokemon)
  229.     end
  230. end
  231.  
  232.  
  233. function Math:Oak(value)
  234.     game.ReplicatedStorage.REvents.Pokemon.Oak:InvokeServer(value)
  235. end
  236.  
  237. function Math:DeoxysChange(Pokemon,newPokemon)
  238.     game.ReplicatedStorage.REvents.Pokemon.DeoxysChange:InvokeServer(Pokemon,newPokemon)
  239. end
  240.  
  241. function Math:RotomChange(Pokemon,newPokemon,newMove)
  242.     game.ReplicatedStorage.REvents.Pokemon.RotomChange:InvokeServer(Pokemon,newPokemon,newMove)
  243. end
  244.  
  245. function Math:GiratinaChange(Pokemon,newPokemon)
  246.     game.ReplicatedStorage.REvents.Pokemon.GiratinaChange:InvokeServer(Pokemon,newPokemon)
  247. end
  248.  
  249. function Math:IVChange(Pokemon)
  250.     return  game.ReplicatedStorage.REvents.Pokemon.IVChange:InvokeServer(Pokemon)          
  251. end
  252.  
  253. function Math:Revive(Pokemon)
  254.     Pokemon.Status.Value = ""
  255.     Pokemon.CurrentHP.Value = math.floor(Pokemon.Stats.HPStat.Value/2)
  256.     game.ReplicatedStorage.REvents.Pokemon.RevivePokemon:FireServer(Pokemon)
  257. end
  258.  
  259. function Math:Caughter(pokemon,pokeball)
  260.     game.ReplicatedStorage.REvents.Pokemon.Caughter:InvokeServer(pokemon,pokeball)
  261. end
  262. function Math:PPUse(val,pressure)
  263.     val.Value = val.Value - 1
  264.      game.ReplicatedStorage.REvents.Pokemon.UsePP:FireServer(val,pressure) 
  265. end
  266. function Math:ResetLevel(Pokemon)
  267.     game.ReplicatedStorage.REvents.Pokemon.ResetLevel:InvokeServer(Pokemon)
  268. end
  269.  
  270. function Math:FixMoves(Pokemon)
  271.     game.ReplicatedStorage.REvents.Pokemon.FixMoves:InvokeServer(Pokemon)
  272. end
  273. function Math:ResetEV(Pokemon)
  274.     game.ReplicatedStorage.REvents.Pokemon.ResetEV:InvokeServer(Pokemon)
  275. end
  276.  
  277. function Math:EVChange(Pokemon,Item)
  278.     game.ReplicatedStorage.REvents.Pokemon.ChangeEVs:InvokeServer(Pokemon,Item)
  279. end
  280. function Math:NatureScientist(Pokemon,FinalNature)
  281.     game.ReplicatedStorage.REvents.Pokemon.NatureScientist:InvokeServer(Pokemon,FinalNature)
  282. end
  283. function Math:TakeDamage(Pokemon,NewHealth)
  284.     if Pokemon.CurrentHP.Value >= NewHealth or NewHealth == 1 then
  285.         Pokemon.CurrentHP.Value = NewHealth
  286.         game.ReplicatedStorage.REvents.Pokemon.TakeDamage:FireServer(Pokemon,NewHealth)
  287.     end
  288. end
  289.  
  290. function Math:SetExp(Pokemon)
  291.     game.ReplicatedStorage.REvents.Pokemon.SetExperienceToLevel:InvokeServer(Pokemon)
  292.     return
  293. end
  294.  
  295. function Math:MaxElixir(Pokemon)
  296.     for i,v in pairs(Pokemon.Moves:GetChildren()) do
  297.             v.PP.Value = _G.Moves[v.Name]["PP"]
  298.     end
  299.     game.ReplicatedStorage.REvents.Pokemon.MaxElixir:FireServer(Pokemon)
  300. end
  301.  
  302. function Math:LevelDown(Pokemon)
  303.     game.ReplicatedStorage.REvents.Pokemon.RedPill:InvokeServer(Pokemon)
  304. end
  305.  
  306. function Math:LevelUp(Pokemon)
  307.     game.ReplicatedStorage.REvents.Pokemon.BluePill:InvokeServer(Pokemon)
  308.     return
  309. end
  310. function Math:SwapPC(Pokemon,newPos)
  311. --  game.ReplicatedStorage.REvents.Pokemon.SwapPC:FireServer(Pokemon,newPos)
  312.     Pokemon.PartyPosition.Value = newPos
  313. end
  314.  
  315. Math.Debounce = false
  316. function Math:SwapParty(Pokemon,newPos)
  317.     Math.Debounce = true
  318.     game.ReplicatedStorage.REvents.Pokemon.SwapParty:InvokeServer(Pokemon,newPos)
  319.     Math.Debounce = false
  320.     --Pokemon.PartyPosition.Value = newPos
  321. end
  322. return Math
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement