Josh64

Julien Character Mod 2

May 30th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 KB | None | 0 0
  1. local Mod = RegisterMod("Julien Gonzalez", 1)
  2. local game = Game()
  3.  
  4. -- stuff for the Julien character
  5. local Julien = {
  6. HasCostume = false, -- for his costume
  7. DAMAGE = 1.05, -- relative to Isaac's base stats.
  8. SPEED = 0.1,
  9. SHOTSPEED = 0.80,
  10. TEARHEIGHT = 0,
  11. TEARFALLINGSPEED = 0,
  12. LUCK = 1,
  13. FLYING = false,
  14. TEARFLAG = 0, -- 0 is default
  15. 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
  16. }
  17.  
  18. local Harbinger = {
  19. HasCostume = false, -- for his costume
  20. DAMAGE = 1.05, -- relative to Isaac's base stats.
  21. SPEED = 0.1,
  22. SHOTSPEED = 0.80,
  23. TEARHEIGHT = 0,
  24. TEARFALLINGSPEED = 0,
  25. LUCK = 1,
  26. FLYING = true,
  27. TEARFLAG = 0, -- 0 is default
  28. 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
  29. }
  30.  
  31. local has = {
  32. HairCostume = false,
  33. -- HarbingerCostume = false,
  34. HairCostumeWhite = false
  35. -- Revived = false, -- for the reviving ability
  36. -- Items = false -- keep track of Harbingers item effects
  37. }
  38.  
  39. Mod.JULIENS_HAIR = Isaac.GetCostumeIdByPath("gfx/characters/juliens_hair.anm2") -- anm for the hair/not sure if it has to be assigned to Mod
  40. Mod.HARBINGERS_HAIR = Isaac.GetCostumeIdByPath("gfx/characters/harbingers_hair.anm2")
  41.  
  42. function Mod:onInit(player)
  43.  
  44. if player:GetName() == "Julien" -- based on the name in the player.xml file
  45. and has.HairCostume == false then -- doesn't have the costume yet
  46. has.HairCostume = true -- has costume
  47. player:AddNullCostume(Mod.JULIENS_HAIR)
  48. -- Harbinger
  49. elseif player:GetName() == "Harbinger" -- based on the name in the player.xml file
  50. and has.HairCostumeWhite == false then -- doesn't have the costume yet
  51. has.HairCostumeWhite = true -- has costume
  52. player:AddNullCostume(Mod.HARBINGERS_HAIR)
  53. player:GetEffect():AddCollectibleEffect(CollectibleType.COLLECTIBLE_MONSTROS_LUNG, true) -- add Monstro's Lung
  54. end
  55.  
  56. -- check if it is not one of two characters
  57. if not (player:GetName() == "Julien") -- not Julien
  58. and has.HairCostume == true then -- but has the hair
  59. has.HairCostume = false -- shouldn't have the costume
  60. player:TryRemoveNullCostume(Mod.JULIENS_HAIR)
  61. end
  62. -- Harbinger
  63. if not (player:GetName() == "Harbinger") -- not Julien
  64. and has.HairCostumeWhite == true then -- but has the hair
  65. has.HairCostumeWhite = false -- shouldn't have the costume
  66. player:TryRemoveNullCostume(Mod.HARBINGERS_HAIR)
  67. end
  68. end
  69. Mod:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, Mod.onInit) -- called when the player is initialized
  70.  
  71. function Mod:onUpdate(player)
  72.  
  73. if player:GetName() == "Harbinger" then
  74. -- now we look for tears
  75. for _, entity in pairs(Isaac.GetRoomEntities()) do
  76. local tearData = entity:GetData()
  77. local sprite = entity:GetSprite()
  78. if entity.Type == EntityType.ENTITY_TEAR then
  79. local tear = entity:ToTear()
  80. if tearData.NewTear == nil --will always be nil at the beginning
  81. tearData.NewTear = 0 -- set tearData.NewTear to 0
  82. -- make Fire Mind tears
  83. tear:ChangeVariant(TearVariant.FIRE_MIND)
  84. tear.TearFlags = tear.TearFlags | TearFlags.FLAG_FIRE -- Fire Mind effect
  85. tear.CollisionDamage = tear.CollisionDamage
  86. tear:SetSize(tear.Size, Vector(1,1), 8)
  87. end
  88. end
  89. end
  90. end
  91. end
  92. Mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Mod.onUpdate) -- called when the game is updated
  93.  
  94. function Mod:onCache(player, cacheFlag)
  95. if player:GetName() == "Julien" then
  96. if cacheFlag == CacheFlag.CACHE_DAMAGE then
  97. player.Damage = player.Damage * Julien.DAMAGE
  98. end
  99. if cacheFlag == CacheFlag.CACHE_SHOTSPEED then
  100. player.ShotSpeed = player.ShotSpeed * Julien*SHOTSPEED
  101. end
  102. if cacheFlag == CacheFlag.CACHE_RANGE then
  103. player.TearHeight = player.TearHeight - Julien.TEARHEIGHT
  104. player.TearFallingSpeed = player.TearFallingSpeed + Julien.TEARFALLINGSPEED
  105. end
  106. if cacheFlag == CacheFlag.CACHE_SPEED then
  107. player.MoveSpeed = player.MoveSpeed + Julien.SPEED
  108. end
  109. if cacheFlag == CacheFlag.CACHE_LUCK then
  110. player.Luck = player.Luck + Julien.LUCK
  111. end
  112. if cacheFlag == CacheFlag.CACHE_FLYING and Julien.FLYING then
  113. player.CanFly = true
  114. end
  115. if cacheFlag == CacheFlag.CACHE_TEARFLAG then
  116. player.TearFlags = player.TearFlags | Julien.TEARFLAG
  117. end
  118. if cacheFlag == CacheFlag.CACHE_TEARCOLOR then
  119. player.TearColor = Julien.TEARCOLOR
  120. end
  121. end
  122. end
  123.  
  124. Mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, Mod.onCache)
Advertisement
Add Comment
Please, Sign In to add comment