tboi-creativelore/main.lua

352 lines
11 KiB
Lua
Raw Normal View History

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]:
-- * Baby Ariel and Baby Yari behaviour
-- * Baby Ariel whole sprite, 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
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
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")
-- 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")
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 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 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 SIVE_HEAD = Isaac.GetCostumeIdByPath("gfx/characters/players/03_Sive_Head.anm2")
-- ON PLAYER INIT!! -- GIVE EM STUFF
function Lore:PostPlayerInit( player )
if player:GetPlayerType() == ARIEL_TYPE then
player:AddNullCostume( ARIEL_HEAD );
player:AddCollectible( CollectibleType.COLLECTIBLE_SUCCUBUS_CHARM, 0, 0);
end
if player:GetPlayerType() == NERIELLE_TYPE then
player:AddNullCostume( NERIELLE_HEAD );
end
if player:GetPlayerType() == SIVE_TYPE then
player:AddNullCostume( SIVE_HEAD );
player.SpriteScale = Vector(1.5,1.5);
player:AddCollectible( CollectibleType.COLLECTIBLE_MOMMY_OF_TWO, 0, 0);
player:AddCollectible( CollectibleType.COLLECTIBLE_YALE_HORNS, 0, 0);
end
end
Lore:AddCallback( ModCallbacks.MC_POST_PLAYER_INIT, Lore.PostPlayerInit );
-- STUFF FOR ENTITIES
-- BABY ARIEL!
function Lore:GetBabyAriel(Ariel)
-- mommy:be_kissed()
end
Lore:AddCallback(ModCallbacks.MC_FAMILIAR_INIT, Lore.GetBabyAriel, FamiliarVariant.BABY_ARIEL)
-- do ur thing baby succubus gal
function Lore:UpdateBabyAriel(Ariel)
end
Lore:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, Lore.UpdateBabyAriel, FamiliarVariant.BABY_ARIEL)
-- BABY YARI
function Lore:GetBabyYari(Yari)
-- ariel:copy()
-- mommy:be_kissed()
end
Lore:AddCallback(ModCallbacks.MC_FAMILIAR_INIT,Lore.GetBabyYari, FamiliarVariant.BABY_YARI)
function Lore:UpdateBabyYari(Yari)
2021-01-06 02:59:55 +00:00
local player = Isaac.GetPlayer(0)
local data = Yari:GetData()
local sprite = Yari:GetSprite()
local FireDir = player:GetFireDirection()
local MoveDir = player:GetMovementDirection()
--if FireDir == Direction.NO_DIRECTION or data.Cooldown > 0 then
2021-01-06 02:59:55 +00:00
Yari:FollowParents()
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
-- Active
function Lore:ActivateSuccubusCharm(_Type, RNG)
local player = Isaac.GetPlayer(0)
2021-01-06 02:59:55 +00:00
local player_data = EntityRef(player)
enemies = Isaac.FindInRadius(player.Position, 125, EntityPartition.ENEMY )
for k,enemy in ipairs(enemies) do
2021-01-06 02:59:55 +00:00
local enemy_data = EntityRef(enemy);
if enemy_data.IsCharmed == true then
print("This entity is charmed! Let's poison them!")
2021-01-06 02:59:55 +00:00
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)
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
BabyYariCount = BabyYariCount + 1
end
if entity.Variant == FamliarVariant.LIL_DRAKE then
LilDrakeCount = LilDrakeCount + 1
end
end
end
while player:GetCollectibleNum(CollectibleType.COLLECTIBLE_MOMMY_OF_TWO) > BabyArielCount do
SpawnFollower(FamiliarVariant.BABY_ARIEL, player)
BabyArielCount = BabyArielCount + 1
end
while player:GetCollectibleNum(CollectibleType.COLLECTIBLE_MOMMY_OF_TWO) > BabyYariCount do
SpawnFollower(FamiliarVariant.BABY_YARI, player)
BabyYariCount = BabyYariCount + 1
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 );
Lore:AddCallback(ModCallbacks.MC_POST_FIRE_TEAR, function(_, 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
if yaleTearCount == 3 then
yaleTearCount = 0;
local lookout = player:GetAimDirection()
local at = math.random(-180,179)
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()
end
end
if player:GetPlayerType() == ARIEL_TYPE then
tear.TearFlags = tear.TearFlags | TearFlags.TEAR_CHARM -- add slowing effect to the tear
end
if player:GetPlayerType() == NERIELLE_TYPE then
tear.TearFlags = tear.TearFlags | TearFlags.TEAR_BURN -- add slowing effect to the tear
end
end)