Skip to content

Commit

Permalink
Fix soul lantern soul drain
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczy93 committed Nov 6, 2024
1 parent 47b6c6d commit 6c8ddee
Showing 1 changed file with 18 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using System;
using Server;
using Server.Spells;
using Server.Network;
using Server.Mobiles;
using Server.Items;
using Server.Misc;
using System.Collections.Generic;
using System.Collections;
using System.Linq;

namespace Server.Spells.DeathKnight
{
Expand Down Expand Up @@ -159,36 +154,30 @@ public static int ComputePowerValue( Mobile from, int div )
return v / div;
}

public static void DrainSoulsInLantern( Mobile from, int tithing )
private static SoulLantern FindSoulLantern(Mobile from)
{
var item = from.FindItemOnLayer(Layer.TwoHanded);
if ( item is SoulLantern )
{
SoulLantern lantern = (SoulLantern)item;
if ( lantern.owner == from )
{
lantern.TrappedSouls = lantern.TrappedSouls - tithing;
if ( lantern.TrappedSouls < 1 ){ lantern.TrappedSouls = 0; }
lantern.InvalidateProperties();
}
}
return (SoulLantern)from.Items.FirstOrDefault(i => i is SoulLantern soulLantern && soulLantern.Owner == from);
}

public static int GetSoulsInLantern( Mobile from )
private static void DrainSoulsInLantern( Mobile from, int tithing )
{
int souls = 0;
var lantern = FindSoulLantern(from);
if(lantern == null)
return;

lantern.TrappedSouls -= tithing;
if ( lantern.TrappedSouls < 1 ){ lantern.TrappedSouls = 0; }
lantern.InvalidateProperties();
}

var item = from.FindItemOnLayer(Layer.TwoHanded);
if ( item is SoulLantern )
private static int GetSoulsInLantern( Mobile from )
{
SoulLantern lantern = FindSoulLantern(from);
if ( lantern != null )
{
SoulLantern lantern = (SoulLantern)item;
if ( lantern.owner == from )
{
souls = lantern.TrappedSouls;
}
return lantern.TrappedSouls;
}

return souls;
return 0;
}

public static int KarmaMax() {
Expand Down

0 comments on commit 6c8ddee

Please sign in to comment.