380 lines
12 KiB
Lua
380 lines
12 KiB
Lua
local Lore = RegisterMod( "thecreativelore", 1 );
|
|
local game = Game()
|
|
local Room = Room
|
|
|
|
-- TO_DO[
|
|
--
|
|
-- ITEMS[
|
|
--
|
|
-- * Add items in pools
|
|
--
|
|
-- [Yale Horns]:
|
|
-- * Make tear inherit common tear properties smh
|
|
-- * Make sure tear properly scales with player.ShotSpeed
|
|
--
|
|
-- [Mommy of Two]:
|
|
-- [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]:
|
|
-- * Make effect happen; < 3 hp -> DMG MULT = 1.25, RANGE += 20
|
|
-- * Decide if go with costume as Noe suggested (horns again?) or better
|
|
-- do a phrase like Whore of Babylon.
|
|
-- * I like the second better.
|
|
--
|
|
-- [Bronze Wings]:
|
|
-- * Get the costume off Nerielle and make it this item instead.
|
|
-- * Make that when u get the item, player can fly.
|
|
-- * This is really that simple.
|
|
--
|
|
-- [Scaly Egg]:
|
|
-- * Make Lil Drake functional
|
|
-- * SPRITE Lil Drake
|
|
-- * Code in Mommy of Two synergy.
|
|
-- * Code in Best Friends Forever Interaction!!
|
|
--
|
|
-- [Bronze Scale]:
|
|
-- * Code in the fire resistance
|
|
-- * Costume spriting
|
|
--
|
|
-- [Zappy Breath]:
|
|
-- * Get Actives Working on this
|
|
-- * Fire Tech X shot somehow
|
|
--
|
|
-- [Dragon Mark]:
|
|
-- * Sprite this somehow!!??
|
|
-- * Think of a better costume. Anything than horns honestly, thats for Nerielle.
|
|
-- * Give tears burning effect
|
|
-- * +1 DMG
|
|
-- * Soul heart :D
|
|
--
|
|
-- [Succubus Charm]
|
|
-- * Make it more fun and engaging
|
|
-- * Make the poison overtime work/check if its the charmed anim over it
|
|
-- * Remove charm if ToPoison
|
|
--
|
|
-- [TRANSFORMATION: True Dragon]
|
|
-- * Get this Working
|
|
-- * Add effects
|
|
-- ]
|
|
--
|
|
-- PLAYERS[
|
|
-- [Ariel]:
|
|
-- * Get Ariel a fun mechanic
|
|
-- * Get costume properly layered
|
|
-- * Fix Ariel Shooting anim -- broken
|
|
--
|
|
-- [Nerielle]:
|
|
-- * Fix Nerielle Shooting anim -- broken.
|
|
-- * Get Nerielle her items.
|
|
--
|
|
-- [Yari]
|
|
-- * Give mom kisses
|
|
-- ]
|
|
-- ]
|
|
|
|
|
|
|
|
--[[ USEFUL FUNCTIONS ]]--
|
|
local function SpawnFollower(Type, player)
|
|
return Isaac.Spawn(EntityType.ENTITY_FAMILIAR, Type, 0, player.Position, Vector(0,0), player):ToFamiliar()
|
|
end
|
|
|
|
local function RealignFamiliars()
|
|
local Caboose = nil
|
|
for _, entity in pairs(Isaac.GetRoomEntities()) do
|
|
if entity.Type == EntityType.ENTITY_FAMILIAR and entity.Child == nil then
|
|
if Caboose == nil then
|
|
Caboose = entity
|
|
else
|
|
if Caboose.FrameCount < entity.FrameCount then
|
|
Caboose.Parent = entity
|
|
entity.Child = Caboose
|
|
else
|
|
Caboose.Child = entity
|
|
entity.Parent = Caboose
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
local function FindClosestEnemy( position, distance, validator )
|
|
local closestDistance = distance or 9999
|
|
local closestEnemy = nil
|
|
local enemies = Isaac.FindInRadius( position, closestDistance, EntityPartition.ENEMY )
|
|
for k,enemy in ipairs(enemies) do
|
|
if enemy:IsActiveEnemy() == true and enemy:IsVulnerableEnemy() == true and enemy:HasEntityFlags( EntityFlag.FLAG_FRIENDLY ) == false then
|
|
local distance = (position - enemy.Position):Length()
|
|
if distance < closestDistance then
|
|
if validator == nil or validator(enemy) == true then
|
|
closestEnemy = enemy
|
|
closestDistance = distance
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return closestEnemy
|
|
end
|
|
|
|
--[[ DECLARING ITEMS ]]--
|
|
|
|
-- Passive Yale Horns
|
|
CollectibleType.COLLECTIBLE_YALE_HORNS = Isaac.GetItemIdByName("Yale Horns")
|
|
COSTUME_YALE_HORNS = Isaac.GetCostumeIdByPath("gfx/characters/XX_YaleHorns.anm2")
|
|
|
|
-- Passive Drake Soul
|
|
CollectibleType.COLLECTIBLE_DRAKE_SOUL = Isaac.GetItemIdByName("Drake Soul")
|
|
|
|
-- Passive Bronze Scale Collar
|
|
CollectibleType.COLLECTIBLE_BRONZE_SCALE = Isaac.GetItemIdByName("Bronze Scale Collar")
|
|
|
|
-- Passive Dragon Mark
|
|
CollectibleType.COLLECTIBLE_DRAGON_MARK = Isaac.GetItemIdByName("Dragon Mark")
|
|
|
|
-- Familiar Mommy of Two
|
|
CollectibleType.COLLECTIBLE_MOMMY_OF_TWO = Isaac.GetItemIdByName("Mommy of Two")
|
|
CollectibleType.COLLECTIBLE_MOMMY_OF_TWO_ARIEL = Isaac.GetItemIdByName("Mommy of Two Ariel")
|
|
CollectibleType.COLLECTIBLE_MOMMY_OF_TWO_YARI = Isaac.GetItemIdByName("Mommy of Two Yari")
|
|
FamiliarVariant.BABY_ARIEL = Isaac.GetEntityVariantByName("Baby Ariel")
|
|
FamiliarVariant.BABY_YARI = Isaac.GetEntityVariantByName("Baby Yari")
|
|
|
|
-- Familiar Scaly Egg
|
|
CollectibleType.COLLECTIBLE_SCALY_EGG = Isaac.GetItemIdByName("Scaly Egg")
|
|
FamiliarVariant.LIL_DRAKE = Isaac.GetEntityVariantByName("Lil Drake")
|
|
FamiliarVariant.BABY_NERIELLE = Isaac.GetEntityVariantByName("Baby Nerielle")
|
|
|
|
-- Active Zappy Breath
|
|
CollectibleType.COLLECTIBLE_ZAPPY_BREATH = Isaac.GetItemIdByName("Zappy Breath!")
|
|
|
|
-- Active Succubus Charm
|
|
CollectibleType.COLLECTIBLE_SUCCUBUS_CHARM = Isaac.GetItemIdByName("Succubus Charm")
|
|
|
|
-- [[ DECLARING CHARACTERS ]] --
|
|
-- 01_Ariel
|
|
local ARIEL_NAME = "01_Ariel";
|
|
local ARIEL_TYPE = Isaac.GetPlayerTypeByName(ARIEL_NAME);
|
|
local ARIEL_STATS = {
|
|
MoveSpeedNaturalBonus = 0.10,
|
|
MoveSpeedNaturalMultiplier = 0.9,
|
|
DamageNaturalMultiplier = 0.70,
|
|
ShotSpeedNaturalMultiplier = 0.8,
|
|
MaxFireDelayNaturalMultiplier = 1.0,
|
|
MaxFireDelayNaturalExponent = 0.9,
|
|
TearHeightBonus = 12,
|
|
};
|
|
local COSTUME_ARIEL_HEAD = Isaac.GetCostumeIdByPath("gfx/characters/players/01_Ariel_Head.anm2")
|
|
|
|
-- 02_Nerielle
|
|
local NERIELLE_NAME = "02_Nerielle";
|
|
local NERIELLE_TYPE = Isaac.GetPlayerTypeByName(NERIELLE_NAME);
|
|
local NERIELLE_STATS = {
|
|
MoveSpeedNaturalBonus = 0.10,
|
|
MoveSpeedNaturalMultiplier = 0.9,
|
|
DamageNaturalMultiplier = 0.70,
|
|
ShotSpeedNaturalMultiplier = 0.8,
|
|
MaxFireDelayNaturalMultiplier = 1.0,
|
|
MaxFireDelayNaturalExponent = 0.9,
|
|
TearHeightBonus = 12,
|
|
};
|
|
local COSTUME_NERIELLE_HEAD = Isaac.GetCostumeIdByPath("gfx/characters/players/02_Nerielle_Head.anm2")
|
|
|
|
-- 03_Sive
|
|
local SIVE_NAME = "03_Sive";
|
|
local SIVE_TYPE = Isaac.GetPlayerTypeByName(SIVE_NAME);
|
|
local SIVE_STATS = {
|
|
MoveSpeedNaturalBonus = 0.10,
|
|
MoveSpeedNaturalMultiplier = 0.9,
|
|
DamageNaturalMultiplier = 0.70,
|
|
ShotSpeedNaturalMultiplier = 0.8,
|
|
MaxFireDelayNaturalMultiplier = 1.0,
|
|
MaxFireDelayNaturalExponent = 0.9,
|
|
TearHeightBonus = 12,
|
|
};
|
|
local COSTUME_SIVE_HEAD = Isaac.GetCostumeIdByPath("gfx/characters/players/03_Sive_Head.anm2")
|
|
|
|
-- ON PLAYER INIT!! -- GIVE EM STUFF
|
|
function Lore:PlayerTypesProperties( resumedGame )
|
|
if resumedGame == false then
|
|
local player = Isaac.GetPlayer(0)
|
|
if player:GetPlayerType() == ARIEL_TYPE then
|
|
player:AddNullCostume( COSTUME_ARIEL_HEAD );
|
|
player:AddCollectible( CollectibleType.COLLECTIBLE_SUCCUBUS_CHARM, 0, 0);
|
|
end
|
|
|
|
if player:GetPlayerType() == NERIELLE_TYPE then
|
|
player:AddNullCostume( COSTUME_NERIELLE_HEAD );
|
|
end
|
|
|
|
if player:GetPlayerType() == SIVE_TYPE then
|
|
player.SpriteScale = Vector(1.5,1.5);
|
|
player:AddCollectible( CollectibleType.COLLECTIBLE_YALE_HORNS, 0, 0);
|
|
player:AddCollectible( CollectibleType.COLLECTIBLE_MOMMY_OF_TWO_YARI, 0, 0);
|
|
player:AddCollectible( CollectibleType.COLLECTIBLE_MOMMY_OF_TWO_ARIEL, 0, 0);
|
|
player:AddNullCostume( COSTUME_SIVE_HEAD );
|
|
end
|
|
end
|
|
end
|
|
Lore:AddCallback( ModCallbacks.MC_POST_GAME_STARTED, Lore.PlayerTypesProperties );
|
|
|
|
-- STUFF FOR ENTITIES
|
|
-- bAriel INIT
|
|
function Lore:GetBabyAriel(Ariel)
|
|
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_FAMILIAR_INIT, Lore.GetBabyAriel, FamiliarVariant.BABY_ARIEL)
|
|
|
|
function Lore:UpdateBabyAriel(Ariel)
|
|
Ariel:FollowParent()
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Lore.UpdateBabyAriel, FamiliarVariant.BABY_ARIEL)
|
|
|
|
-- BABY YARI
|
|
function Lore:GetBabyYari(Yari)
|
|
Yari.FireCooldown = 1
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_FAMILIAR_INIT,Lore.GetBabyYari, FamiliarVariant.BABY_YARI)
|
|
|
|
function Lore:UpdateBabyYari(Yari)
|
|
local player = Isaac.GetPlayer(0)
|
|
Yari:PickEnemyTarget(400,5)
|
|
Yari:Shoot()
|
|
local MoveDir = player:GetMovementDirection()
|
|
Yari:FollowParent()
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Lore.UpdateBabyYari, FamiliarVariant.BABY_YARI)
|
|
|
|
-- LIL DRAKE
|
|
function Lore:GetLilDrake(Drake)
|
|
-- Drake:doDrakeStuff()
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_FAMILIAR_INIT,Lore.GetLilDrake, FamiliarVariant.LIL_DRAKE)
|
|
|
|
-- STUFF FOR ITEMS
|
|
|
|
-- Passive
|
|
function Lore:PassiveYaleHorns(tear)
|
|
local player = Isaac.GetPlayer(0) -- get the player entity
|
|
if player:HasCollectible(CollectibleType.COLLECTIBLE_YALE_HORNS) == true then
|
|
if yaleTearCount == nil then
|
|
yaleTearCount = 0
|
|
end
|
|
yaleTearCount = yaleTearCount + 1
|
|
print(yaleTearCount)
|
|
if yaleTearCount == 3 then
|
|
yaleTearCount = 0;
|
|
local lookout = Vector(1,0)
|
|
local at = math.random(1,180)
|
|
local finalTear = lookout:Rotated(at):Resized(player.ShotSpeed*10)
|
|
player:FireTear(player.Position, finalTear, 1, 1, 0)
|
|
local finalTear = lookout:Rotated(at+180):Resized(player.ShotSpeed*10)
|
|
player:FireTear(player.Position, finalTear, 1, 1, 0)
|
|
end
|
|
end
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_POST_FIRE_TEAR, Lore.PassiveYaleHorns)
|
|
|
|
-- Active
|
|
function Lore:ActivateSuccubusCharm(_Type, RNG)
|
|
local player = Isaac.GetPlayer(0)
|
|
local player_data = EntityRef(player)
|
|
enemies = Isaac.FindInRadius(player.Position, 125, EntityPartition.ENEMY )
|
|
for k,enemy in ipairs(enemies) do
|
|
local enemy_data = EntityRef(enemy);
|
|
if enemy_data.IsCharmed == true then
|
|
print("This entity is charmed! Let's poison them!")
|
|
enemy:AddPoison(player_data, 120, 1)
|
|
else
|
|
print("This entity isn't charmed! Let's charm them!")
|
|
enemy:AddCharmed(120)
|
|
end
|
|
end
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_USE_ITEM, Lore.ActivateSuccubusCharm, CollectibleType.COLLECTIBLE_SUCCUBUS_CHARM)
|
|
|
|
-- STUFF FOR PLAYERS
|
|
function Lore:PlayerUpdate( player )
|
|
if player:GetPlayerType() == ARIEL_TYPE then
|
|
end
|
|
if player:GetPlayerType() == NERIELLE_TYPE then
|
|
end
|
|
end
|
|
Lore:AddCallback( ModCallbacks.MC_POST_PLAYER_UPDATE, Lore.PlayerUpdate );
|
|
|
|
|
|
|
|
function Lore:onCache( player, cacheFlag)
|
|
BabyArielCount = 0
|
|
BabyYariCount = 0
|
|
BabyLilDrakeCount = 0
|
|
if cacheFlag == CacheFlag.CACHE_FAMILIARS then
|
|
for _, entity in pairs(Isaac.GetRoomEntities()) do
|
|
if entity.Type == EntityType.ENTITY_FAMILIAR then
|
|
print(entity.Type, entity.Variant)
|
|
if entity.Variant == FamiliarVariant.BABY_ARIEL then
|
|
BabyArielCount = BabyArielCount + 1
|
|
end
|
|
if entity.Variant == FamiliarVariant.BABY_YARI then
|
|
BabyYariCount = BabyYariCount + 1
|
|
end
|
|
if entity.Variant == FamiliarVariant.LIL_DRAKE then
|
|
LilDrakeCount = LilDrakeCount + 1
|
|
end
|
|
end
|
|
end
|
|
|
|
while player:GetCollectibleNum(CollectibleType.COLLECTIBLE_MOMMY_OF_TWO_ARIEL) > BabyArielCount do
|
|
BabyArielCount = BabyArielCount + 1
|
|
SpawnFollower(FamiliarVariant.BABY_ARIEL, player)
|
|
end
|
|
while player:GetCollectibleNum(CollectibleType.COLLECTIBLE_MOMMY_OF_TWO_YARI) > BabyYariCount do
|
|
BabyYariCount = BabyYariCount + 1
|
|
SpawnFollower(FamiliarVariant.BABY_YARI, player)
|
|
end
|
|
while player:GetCollectibleNum(CollectibleType.COLLECTIBLE_SCALY_EGG) > BabyLilDrakeCount do
|
|
SpawnFollower(FamiliarVariant.LIL_DRAKE, player)
|
|
BabyLilDrakeCount = BabyLilDrakeCount + 1
|
|
end
|
|
RealignFamiliars()
|
|
end
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, Lore.onCache)
|
|
|
|
function Lore:EvaluateCache( player, cacheFlag )
|
|
local player = Isaac.GetPlayer(0) -- get the player entity
|
|
if player:GetPlayerType() == ARIEL_TYPE then
|
|
if cacheFlag == CacheFlag.CACHE_FLYING then
|
|
player.CanFly = 1
|
|
end
|
|
end
|
|
if player:GetPlayerType() == NERIELLE_TYPE then
|
|
if cacheFlag == CacheFlag.CACHE_FLYING then
|
|
player.CanFly = 1
|
|
end
|
|
end
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, Lore.EvaluateCache );
|
|
|
|
function Lore:manageItems(player)
|
|
if game:GetFrameCount() == 1 then
|
|
end
|
|
if player:GetActiveItem() == CollectibleType.COLLECTIBLE_SUCCUBUS_CHARM then
|
|
local itemCharge = player:GetActiveCharge()
|
|
print("Pre:",itemCharge)
|
|
if itemCharge < 110 then
|
|
itemCharge = itemCharge + 1
|
|
end
|
|
print("Post",ItemCharge)
|
|
player:SetActiveCharge(itemCharge)
|
|
end
|
|
if player:HasCollectible(CollectibleType.COLLECTIBLE_MOMMY_OF_TWO) then
|
|
player:AddCollectible(CollectibleType.COLLECTIBLE_MOMMY_OF_TWO_YARI,0,0)
|
|
player:AddCollectible(CollectibleType.COLLECTIBLE_MOMMY_OF_TWO_ARIEL,0,0)
|
|
player:RemoveCollectible(CollectibleType.COLLECTIBLE_MOMMY_OF_TWO)
|
|
end
|
|
end
|
|
Lore:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, Lore.manageItems)
|