Advertisement
Jesseroo

My Crap main.lua

Feb 27th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.79 KB | None | 0 0
  1. local JokerMod = RegisterMod("Joker", 1)
  2. local game = Game()
  3. local MIN_FIRE_DELAY = 5
  4.  
  5. local GunId = {
  6.     GUN = Isaac.GetItemByName("Gun")
  7. }
  8.  
  9. local HasGun = {
  10.     Gun = false
  11. }
  12.  
  13. local GunBonus = {
  14.     GunSize = 1.5
  15.     GunSpeed = 2
  16.     GunFireRate = 2
  17.     GunDamage = 5
  18. }
  19.  
  20. local function UpdateGun(player)
  21. HasGun.Gun = player:HasCollectible(GunId.GUN)
  22. end
  23.  
  24. function JokerMod:onPlayerInit(player)
  25.     UpdateGun(player)
  26. end
  27.  
  28. JokerMod:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, JokerMod.onPlayerInit)
  29.  
  30. JokerMod:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, JokerMod.onPlayerInit)
  31.  
  32. COSTUME_Joker = Isaac.GetCostumeIdByPath("gfx/characters/character_420_jokerHead.anm2")
  33.  
  34.  
  35. --Applying Joker's costume
  36. function JokerMod:PlayerCostume(player)
  37. local player = Isaac.GetPlayer(0)
  38.     if player:GetName() == "Joker" then
  39.         player:AddNullCostume(COSTUME_Joker)
  40.     end
  41. end
  42.  
  43. local Joker = { -- Change Joker everywhere to match your character. No spaces!
  44.     DAMAGE = 1, -- These are all relative to Isaac's base stats.
  45.     SPEED = 2,
  46.     SHOTSPEED = 3,
  47.     TEARHEIGHT = 2,
  48.     TEARFALLINGSPEED = 3,
  49.     LUCK = 1.5,
  50.     FLYING = false,
  51.     TEARFLAG = 0, -- 0 is default
  52.     TEARCOLOR = Color(1.0, 1.0, 1.0, 1.0, 0, 0, 0)  -- Color(1.0, 1.0, 1.0, 1.0, 0, 0, 0) is default
  53. }
  54.  
  55. function Joker:onCache(player, cacheFlag) -- I do mean everywhere!
  56.  
  57.     if cacheFlag == CacheFlag.CACHE_DAMAGE then
  58.         if player:HasCollectible(GunId.Gun) and not HasGun.Gun then
  59.             if player.MaxFireDelay >= MIN_FIRE_DELAY - GunFireRate.GUN
  60.                 player.MaxFireDelay = player.MaxFireDelay + GunFireRate.GUN
  61.             elseif player.MaxFireDelay >= MIN_FIRE_DELAY then
  62.             player.MaxFireDelay = MIN_FIRE_DELAY
  63.             end
  64.            
  65.             player.Damage = player.Damage + GunDamage.GUN
  66.            
  67.         end
  68.     end
  69.    
  70.     if cacheFlag == CacheFlag.CACHE_SHOTSPEED then
  71.         if player:HasCollectible(GunId.Gun) and not HasGun.Gun then
  72.             player.ShotSpeed = player.ShotSpeed + GunSpeed.GUN
  73.         end
  74.     end
  75.    
  76.     if cacheFlag == CacheFlag.CACHE_TEARFLAG then
  77.         if player:HasCollectible(GunId.Gun) and not HasGun.Gun then
  78.             player.TearSize = player.TearSize - GunSize.GUN
  79.         end
  80.     end
  81.    
  82. end
  83.  
  84.  
  85.  
  86. --Removing any other costumes
  87. function JokerMod:onUpdate(player)
  88.     local player = Isaac.GetPlayer(0)
  89.     if player:GetName() == "Joker" then
  90.         if numocollect ~= player:GetCollectibleCount() then
  91.         numocollect = player:GetCollectibleCount()
  92.         player:ClearCostumes()
  93.         player:AddNullCostume(COSTUME_Joker)
  94. if game:GetFrameCount() == 1 then
  95.     if player:GetName() == "Joker" then
  96.             player:AddCollectible(GunId.Gun, 0, true)
  97.         end
  98.     end
  99. end
  100.         UpdateGun(player)
  101.    
  102. end
  103. JokerMod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, JokerMod.onUpdate)
  104. JokerMod:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, JokerMod.PlayerCostume)
  105. JokerMod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, JokerMod.onCache)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement