From e8187c6c203f7e2cff580577ea9a77bff1245cb3 Mon Sep 17 00:00:00 2001 From: UndeadMaelys Date: Wed, 6 Jan 2021 06:44:26 +0100 Subject: [PATCH] Half-coded Yari's AI but im not convinced -- I want yari to act as a turret, not copy player (which also creates a bug, if u quickly stop shooting after tear out) --- main.lua | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/main.lua b/main.lua index a0c0c19..c4abe7e 100644 --- a/main.lua +++ b/main.lua @@ -13,8 +13,10 @@ local Room = Room -- * Make sure tear properly scales with player.ShotSpeed -- -- [Mommy of Two]: --- * Baby Ariel and Baby Yari behaviour --- * Baby Ariel whole sprite, finish Yari's one too. +-- [DONE] Baby Ariel whole sprite +-- [DONE] Baby Yari behaviour +-- * do Ariel behaviour +-- * finish Yari's one too. -- * Code in Best Friends Forever Interaction!! -- -- [Drake Soul]: @@ -217,25 +219,23 @@ Lore:AddCallback( ModCallbacks.MC_POST_PLAYER_INIT, Lore.PostPlayerInit ); Lore:AddCallback(ModCallbacks.MC_FAMILIAR_INIT, Lore.GetBabyAriel, FamiliarVariant.BABY_ARIEL) -- do ur thing baby succubus gal function Lore:UpdateBabyAriel(Ariel) + Ariel:FollowParent() end Lore:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Lore.UpdateBabyAriel, FamiliarVariant.BABY_ARIEL) -- BABY YARI function Lore:GetBabyYari(Yari) -- ariel:copy() - -- mommy:be_kissed() + Yari.FireCooldown = 1 end Lore:AddCallback(ModCallbacks.MC_FAMILIAR_INIT,Lore.GetBabyYari, FamiliarVariant.BABY_YARI) function Lore:UpdateBabyYari(Yari) local player = Isaac.GetPlayer(0) - local data = Yari:GetData() - local sprite = Yari:GetSprite() - local FireDir = player:GetFireDirection() + Yari:PickEnemyTarget(400,5) + Yari:Shoot() local MoveDir = player:GetMovementDirection() - - --if FireDir == Direction.NO_DIRECTION or data.Cooldown > 0 then - Yari:FollowParents() + Yari:FollowParent() end Lore:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Lore.UpdateBabyYari, FamiliarVariant.BABY_YARI) @@ -274,26 +274,27 @@ function Lore:PlayerUpdate( player ) end Lore:AddCallback( ModCallbacks.MC_POST_PLAYER_UPDATE, Lore.PlayerUpdate ); + +local BabyArielCount = 0 +local BabyYariCount = 0 +local BabyLilDrakeCount = 0 function Lore:onCache( player, cacheFlag) if cacheFlag == CacheFlag.CACHE_FAMILIARS then - - local BabyArielCount = 0 - local BabyYariCount = 0 - local BabyLilDrakeCount = 0 - for _, entity in pairs(Isaac.GetRoomEntities()) do if EntityType == EntityType.ENTITY_FAMILIAR then if entity.Variant == FamliarVariant.BABY_ARIEL then BabyArielCount = BabyArielCount + 1 - end - if entity.Variant == FamliarVariant.BABY_YARI then + elseif entity.Variant == FamliarVariant.BABY_YARI then BabyYariCount = BabyYariCount + 1 - end - if entity.Variant == FamliarVariant.LIL_DRAKE then + elseif entity.Variant == FamliarVariant.LIL_DRAKE then LilDrakeCount = LilDrakeCount + 1 end end end + print("FAMILIAR DATA ON INIT") + print(" [Ariel] FamiliarVariant:",FamiliarVariant.BABY_ARIEL," Count: ",BabyArielCount) + print(" [Yari] FamiliarVariant:",FamiliarVariant.BABY_YARI," Count: ",BabyYariCount) + print("[Lil Drake] FamiliarVariant:",FamiliarVariant.LIL_DRAKE," Count: ",BabyLilDrakeCount) while player:GetCollectibleNum(CollectibleType.COLLECTIBLE_MOMMY_OF_TWO) > BabyArielCount do SpawnFollower(FamiliarVariant.BABY_ARIEL, player) BabyArielCount = BabyArielCount + 1 @@ -340,6 +341,10 @@ Lore:AddCallback(ModCallbacks.MC_POST_FIRE_TEAR, function(_, tear) local finalTear = lookout:Rotated(at):Resized(player.ShotSpeed*10) local tearCopy = tear.Variant Isaac.Spawn(EntityType.ENTITY_TEAR, tearCopy, 0, player.Position, finalTear, player):ToTear() + + local finalTear = lookout:Rotated(at+180):Resized(player.ShotSpeed*10) + local tearCopy = tear.Variant + Isaac.Spawn(EntityType.ENTITY_TEAR, tearCopy, 0, player.Position, finalTear, player):ToTear() end end