121 lines
5.4 KiB
Lua
121 lines
5.4 KiB
Lua
local Lore = RegisterMod( "thecreativelore", 1 );
|
|
--[[ USEFUL FUNCTIONS ]]--
|
|
|
|
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
|
|
|
|
--[[ CHARACTERS ]]--
|
|
-- 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")
|
|
|
|
|
|
-- 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")
|
|
|
|
function Lore:PostPlayerInit( player )
|
|
if player:GetPlayerType() == ARIEL_TYPE then
|
|
player:AddNullCostume( ARIEL_HEAD );
|
|
end
|
|
if player:GetPlayerType() == NERIELLE_TYPE then
|
|
player:AddNullCostume( NERIELLE_HEAD );
|
|
end
|
|
end
|
|
Lore:AddCallback( ModCallbacks.MC_POST_PLAYER_INIT, Lore.PostPlayerInit );
|
|
|
|
|
|
--[[ Stats ]]
|
|
function Lore:EvaluateCache( player, cacheFlag )
|
|
local player = Isaac.GetPlayer(0) -- get the player entity
|
|
if player:GetPlayerType() == ARIEL_TYPE then
|
|
--[[ if cacheFlag == CacheFlag.CACHE_SPEED then
|
|
player.MoveSpeed = player.Mññº
|
|
moveSpeed * ARIEL_STATS.MoveSpeedNaturalMultiplier + ARIEL_STATS.MoveSpeedNaturalBonus;
|
|
elseif cacheFlag == CacheFlag.CACHE_SHOTSPEED then
|
|
player.ShotSpeed = player.ShotSpeed * ARIEL_STATS.ShotSpeedNaturalMultiplier;
|
|
elseif cacheFlag == CacheFlag.CACHE_DAMAGE then
|
|
player.Damage = player.Damage * ARIEL_STATS.DamageNaturalMultiplier;
|
|
elseif cacheFlag == CacheFlag.CACHE_FIREDELAY then
|
|
player.MaxFireDelay = math.floor( math.max( 1, player.MaxFireDelay * ARIEL_STATS.MaxFireDelayNaturalMultiplier ) ^ ARIEL_STATS.MaxFireDelayNaturalExponent );
|
|
elseif cacheFlag == CacheFlag.CACHE_RANGE then
|
|
player.TearHeight = player.TearHeight + ARIEL_STATS.TearHeightBonus;
|
|
elseif cacheFlag == CacheFlag.CACHE_TEARCOLOR then
|
|
--player.TearColor = GAPPI_COLOR;
|
|
--Player.LaserColor = GAPPI_COLOR;
|
|
end]]
|
|
if cacheFlag == CacheFlag.CACHE_FLYING then
|
|
player.CanFly = 1
|
|
end
|
|
end
|
|
if player:GetPlayerType() == NERIELLE_TYPE then
|
|
--[[ if cacheFlag == CacheFlag.CACHE_SPEED then
|
|
player.MoveSpeed = player.Mññº
|
|
moveSpeed * ARIEL_STATS.MoveSpeedNaturalMultiplier + ARIEL_STATS.MoveSpeedNaturalBonus;
|
|
elseif cacheFlag == CacheFlag.CACHE_SHOTSPEED then
|
|
player.ShotSpeed = player.ShotSpeed * ARIEL_STATS.ShotSpeedNaturalMultiplier;
|
|
elseif cacheFlag == CacheFlag.CACHE_DAMAGE then
|
|
player.Damage = player.Damage * ARIEL_STATS.DamageNaturalMultiplier;
|
|
elseif cacheFlag == CacheFlag.CACHE_FIREDELAY then
|
|
player.MaxFireDelay = math.floor( math.max( 1, player.MaxFireDelay * ARIEL_STATS.MaxFireDelayNaturalMultiplier ) ^ ARIEL_STATS.MaxFireDelayNaturalExponent );
|
|
elseif cacheFlag == CacheFlag.CACHE_RANGE then
|
|
player.TearHeight = player.TearHeight + ARIEL_STATS.TearHeightBonus;
|
|
elseif cacheFlag == CacheFlag.CACHE_TEARCOLOR then
|
|
--player.TearColor = GAPPI_COLOR;
|
|
--Player.LaserColor = GAPPI_COLOR;
|
|
end]]
|
|
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: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)
|