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)

This commit is contained in:
UndeadMaelys 2021-01-06 06:44:26 +01:00
parent d5011aabc4
commit e8187c6c20
1 changed files with 23 additions and 18 deletions

View File

@ -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 );
function Lore:onCache( player, cacheFlag)
if cacheFlag == CacheFlag.CACHE_FAMILIARS then
local BabyArielCount = 0
local BabyYariCount = 0
local BabyLilDrakeCount = 0
function Lore:onCache( player, cacheFlag)
if cacheFlag == CacheFlag.CACHE_FAMILIARS then
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