Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local JokerMod = RegisterMod("Joker", 1)
- local game = Game()
- local MIN_FIRE_DELAY = 5
- local GunId = {
- GUN = Isaac.GetItemByName("Gun")
- }
- local HasGun = {
- Gun = false
- }
- local GunBonus = {
- GunSize = 1.5
- GunSpeed = 2
- GunFireRate = 2
- GunDamage = 5
- }
- local function UpdateGun(player)
- HasGun.Gun = player:HasCollectible(GunId.GUN)
- end
- function JokerMod:onPlayerInit(player)
- UpdateGun(player)
- end
- JokerMod:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, JokerMod.onPlayerInit)
- JokerMod:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, JokerMod.onPlayerInit)
- COSTUME_Joker = Isaac.GetCostumeIdByPath("gfx/characters/character_420_jokerHead.anm2")
- --Applying Joker's costume
- function JokerMod:PlayerCostume(player)
- local player = Isaac.GetPlayer(0)
- if player:GetName() == "Joker" then
- player:AddNullCostume(COSTUME_Joker)
- end
- end
- local Joker = { -- Change Joker everywhere to match your character. No spaces!
- DAMAGE = 1, -- These are all relative to Isaac's base stats.
- SPEED = 2,
- SHOTSPEED = 3,
- TEARHEIGHT = 2,
- TEARFALLINGSPEED = 3,
- LUCK = 1.5,
- FLYING = false,
- TEARFLAG = 0, -- 0 is default
- 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
- }
- function Joker:onCache(player, cacheFlag) -- I do mean everywhere!
- if cacheFlag == CacheFlag.CACHE_DAMAGE then
- if player:HasCollectible(GunId.Gun) and not HasGun.Gun then
- if player.MaxFireDelay >= MIN_FIRE_DELAY - GunFireRate.GUN
- player.MaxFireDelay = player.MaxFireDelay + GunFireRate.GUN
- elseif player.MaxFireDelay >= MIN_FIRE_DELAY then
- player.MaxFireDelay = MIN_FIRE_DELAY
- end
- player.Damage = player.Damage + GunDamage.GUN
- end
- end
- if cacheFlag == CacheFlag.CACHE_SHOTSPEED then
- if player:HasCollectible(GunId.Gun) and not HasGun.Gun then
- player.ShotSpeed = player.ShotSpeed + GunSpeed.GUN
- end
- end
- if cacheFlag == CacheFlag.CACHE_TEARFLAG then
- if player:HasCollectible(GunId.Gun) and not HasGun.Gun then
- player.TearSize = player.TearSize - GunSize.GUN
- end
- end
- end
- --Removing any other costumes
- function JokerMod:onUpdate(player)
- local player = Isaac.GetPlayer(0)
- if player:GetName() == "Joker" then
- if numocollect ~= player:GetCollectibleCount() then
- numocollect = player:GetCollectibleCount()
- player:ClearCostumes()
- player:AddNullCostume(COSTUME_Joker)
- if game:GetFrameCount() == 1 then
- if player:GetName() == "Joker" then
- player:AddCollectible(GunId.Gun, 0, true)
- end
- end
- end
- UpdateGun(player)
- end
- JokerMod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, JokerMod.onUpdate)
- JokerMod:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, JokerMod.PlayerCostume)
- JokerMod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, JokerMod.onCache)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement