Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.89 KB | None | 0 0
  1. local PriestMod = RegisterMod("Priest", 1)
  2. local firemage = Isaac.GetItemIdByName("Firemage")
  3.  
  4. local player = Isaac.GetPlayer(0)
  5. local altershotspeed = 0
  6. local frames_passed = 0
  7. local frames_passed2 = 0
  8. local geschossen = false
  9. local countdownbasezeit = 1.5
  10. local grundscale = nil
  11. local firedelay = player.FireDelay
  12. local aufladezeit = 1
  13.  
  14. function PriestMod:rechner()
  15.  
  16. aufladezeit = math.ceil((player.FireDelay*(-1)) * 55 * (countdownbasezeit-0.2))
  17. countdownzeit = math.ceil((firedelay*(-1)) * countdownbasezeit * 55)
  18.  
  19. end
  20. PriestMod:AddCallback(ModCallbacks.MC_POST_UPDATE, PriestMod.rechner)
  21.  
  22. function PriestMod:Spielstart()
  23.  local start = Game():GetFrameCount()
  24. if start == 1 then
  25.   geschossen = false
  26.   gedruekt = false
  27.   frames_passed = 0
  28.   frames_passed2 = 0
  29. end
  30. end
  31. PriestMod:AddCallback(ModCallbacks.MC_POST_UPDATE, PriestMod.Spielstart)
  32.  
  33. function PriestMod:pfeiltastendruck(player, hook, but)
  34.   player = Isaac.GetPlayer(0)
  35.   if geschossen == true and (but == ButtonAction.ACTION_SHOOTUP or but == ButtonAction.ACTION_SHOOTLEFT or but == ButtonAction.ACTION_SHOOTRIGHT or but == ButtonAction.ACTION_SHOOTDOWN) then
  36.     return false
  37.   end
  38. end
  39. PriestMod:AddCallback(ModCallbacks.MC_INPUT_ACTION, PriestMod.pfeiltastendruck, InputHook.IS_ACTION_PRESSED)
  40.  
  41. function PriestMod:Itemaufheben()
  42.     grundscale = tear.Scale
  43.     altershotspeed = player.ShotSpeed
  44.     player.ShotSpeed = 0
  45.   end
  46.   PriestMod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, PriestMod.Itemaufheben)
  47.  
  48. function PriestMod:Traene()
  49.   player = Isaac.GetPlayer(0)
  50.   entities = Isaac.GetRoomEntities()
  51.   if player:HasCollectible(firemage) and geschossen == false then
  52.        for i = 1, #entities do
  53.        teartest = entities[i]:ToTear()
  54.        if teartest ~= nil then
  55.        if teartest.Parent.Type == EntityType.ENTITY_PLAYER then
  56.        teartest.FallingSpeed = 0
  57.        teartest.FallingAcceleration = -0.1
  58.        geschossen = true
  59.        return teartest
  60.        end
  61.        end
  62.        end
  63.   end
  64. end
  65. PriestMod:AddCallback(ModCallbacks.MC_POST_UPDATE, PriestMod.Traene)
  66.  
  67. function PriestMod:Traeneposition()
  68.   player = Isaac.GetPlayer(0)
  69.   if player:HasCollectible(firemage) and geschossen == true then
  70.       tear = PriestMod.Traene()
  71.     aimdir = player:GetAimDirection()
  72.     tear.Position = Vector(player.Position.X, player.Position.Y) + aimdir*30
  73.    
  74.   end
  75. end
  76. PriestMod:AddCallback(ModCallbacks.MC_POST_UPDATE, PriestMod.Traeneposition)
  77.  
  78. function PriestMod:aufladen()
  79.   player = Isaac.GetPlayer(0)
  80.   if player:HasCollectible(firemage) and geschossen == true then
  81.     frames_passed2 = frames_passed2 + 1
  82.     if frames_passed2 == math.ceil(aufladezeit/5) then
  83.       tear.Scale = grundscale/3
  84.       Isaac.DebugString("Scalestufe: 1")
  85.     end
  86.     if frames_passed2 == math.ceil((aufladezeit*2)/5) then
  87.       tear.Scale = grundscale/2
  88.       Isaac.DebugString("Scalestufe: 2")
  89.     end
  90.     if frames_passed2 == math.ceil((aufladezeit*3)/5) then
  91.       tear.Scale = grundscale
  92.       Isaac.DebugString("Scalestufe: 3")
  93.     end
  94.     if frames_passed2 == math.ceil((aufladezeit*4)/5) then
  95.       tear.Scale = grundscale*2
  96.       Isaac.DebugString("Scalestufe: 4")
  97.     end
  98.     if frames_passed2 == aufladezeit then
  99.       tear.Scale = grundscale*3
  100.       Isaac.DebugString("Scalestufe: 5")
  101.       shotspeedvector = Vector(1, 1)
  102.       tear:AddVelocity(shotspeedvector)
  103.       frames_passed2 = 0
  104.     end
  105.   end
  106. end
  107. PriestMod:AddCallback(ModCallbacks.MC_POST_UPDATE, PriestMod.aufladen)
  108.  
  109. function PriestMod:countdown()
  110.   player = Isaac.GetPlayer(0)
  111.   if player:HasCollectible(firemage) and geschossen == true then
  112.     frames_passed = frames_passed + 1
  113.     Isaac.DebugString("countdownzeit: " .. countdownzeit .. " | " .. frames_passed)
  114.     if frames_passed == countdownzeit then
  115.       geschossen = false
  116.       frames_passed = 0
  117.     end
  118.   end
  119. end
  120. PriestMod:AddCallback(ModCallbacks.MC_POST_UPDATE, PriestMod.countdown)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement