Fixed type conditioned access, if type pattern merge, fixed some floating point comparisons
This commit is contained in:
parent
59f7c47c83
commit
018311cdb8
@ -50,7 +50,6 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
|
|||||||
return base.Reveal(player);
|
return base.Reveal(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void OnTargeted(Player player, TargetMessage message)
|
public override void OnTargeted(Player player, TargetMessage message)
|
||||||
{
|
{
|
||||||
if (Attributes[GameAttribute.Disabled]) return;
|
if (Attributes[GameAttribute.Disabled]) return;
|
||||||
|
|||||||
@ -88,11 +88,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
if (Target.Dead)
|
if (Target.Dead)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Target is Player)
|
if (Target is Player plr)
|
||||||
{
|
{
|
||||||
var plr = Target as Player;
|
if(plr.World.Game.NephalemGreater)
|
||||||
if(Target.World.Game.NephalemGreater)
|
plr.Attributes[GameAttribute.Tiered_Loot_Run_Death_Count]++;
|
||||||
(Target as Player).Attributes[GameAttribute.Tiered_Loot_Run_Death_Count]++;
|
|
||||||
if (plr.SkillSet.HasPassive(218501) && plr.World.BuffManager.GetFirstBuff<SpiritVesselCooldownBuff>(plr) == null) //SpiritWessel (wd)
|
if (plr.SkillSet.HasPassive(218501) && plr.World.BuffManager.GetFirstBuff<SpiritVesselCooldownBuff>(plr) == null) //SpiritWessel (wd)
|
||||||
{
|
{
|
||||||
plr.Attributes[GameAttribute.Hitpoints_Cur] = plr.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.15f;
|
plr.Attributes[GameAttribute.Hitpoints_Cur] = plr.Attributes[GameAttribute.Hitpoints_Max_Total] * 0.15f;
|
||||||
@ -110,16 +109,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Target is Hireling)
|
if (Target is Hireling hireling)
|
||||||
{
|
{
|
||||||
Hireling mon = (Hireling)Target;
|
hireling.Dead = true;
|
||||||
mon.Dead = true;
|
|
||||||
|
|
||||||
if (mon.Dead)
|
if (hireling.Dead)
|
||||||
{
|
{
|
||||||
mon.Attributes[GameAttribute.Hitpoints_Cur] = mon.Attributes[GameAttribute.Hitpoints_Max_Total];
|
hireling.Attributes[GameAttribute.Hitpoints_Cur] = hireling.Attributes[GameAttribute.Hitpoints_Max_Total];
|
||||||
mon.Attributes.BroadcastChangedIfRevealed();
|
hireling.Attributes.BroadcastChangedIfRevealed();
|
||||||
mon.Dead = false;
|
hireling.Dead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -144,92 +142,80 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Target is NecromancerSkeleton_A)
|
if (Target is NecromancerSkeleton_A { Master: Player masterPlr } skeletonA)
|
||||||
{
|
{
|
||||||
//(this.Target as NecromancerSkeleton_A).Master+
|
//(this.Target as NecromancerSkeleton_A).Master+
|
||||||
((Target as NecromancerSkeleton_A).Master as Player).InGameClient.SendMessage(new MessageSystem.Message.Definitions.Pet.PetDetachMessage()
|
masterPlr.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Pet.PetDetachMessage()
|
||||||
{
|
{
|
||||||
PetId = Target.DynamicID(((Target as NecromancerSkeleton_A).Master as Player))
|
PetId = skeletonA.DynamicID((skeletonA.Master as Player))
|
||||||
});
|
});
|
||||||
((Target as NecromancerSkeleton_A).Master as Player).NecroSkeletons.Remove(Target);
|
masterPlr.NecroSkeletons.Remove(skeletonA);
|
||||||
}
|
}
|
||||||
if (Target is BaseGolem ||
|
if (Target is Minion { Master: Player masterPlr2 } and (BaseGolem or IceGolem or BoneGolem or DecayGolem or ConsumeFleshGolem or BloodGolem))
|
||||||
Target is IceGolem ||
|
|
||||||
Target is BoneGolem ||
|
|
||||||
Target is DecayGolem ||
|
|
||||||
Target is ConsumeFleshGolem ||
|
|
||||||
Target is BloodGolem)
|
|
||||||
{
|
{
|
||||||
((Target as Minion).Master as Player).InGameClient.SendMessage(new MessageSystem.Message.Definitions.Pet.PetDetachMessage()
|
masterPlr2.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Pet.PetDetachMessage()
|
||||||
{
|
{
|
||||||
PetId = Target.DynamicID(((Target as Minion).Master as Player))
|
PetId = Target.DynamicID(((Target as Minion).Master as Player))
|
||||||
});
|
});
|
||||||
((Target as Minion).Master as Player).ActiveGolem = null;
|
masterPlr2.ActiveGolem = null;
|
||||||
}
|
}
|
||||||
if (Target is Player)
|
if (Target is Player user)
|
||||||
{
|
{
|
||||||
var plr = Target as Player;
|
if (user.SkillSet.HasPassive(208779)) //Grenadier (DH)
|
||||||
|
|
||||||
if (plr.SkillSet.HasPassive(208779)) //Grenadier (DH)
|
|
||||||
{
|
{
|
||||||
plr.World.PowerManager.RunPower(plr, 208779);
|
user.World.PowerManager.RunPower(user, 208779);
|
||||||
}
|
}
|
||||||
|
|
||||||
plr.Attributes.BroadcastChangedIfRevealed();
|
user.Attributes.BroadcastChangedIfRevealed();
|
||||||
|
|
||||||
DoPlayerDeath();
|
DoPlayerDeath();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Context != null)
|
if (Context != null)
|
||||||
if (Context.User is Player) //Hitpoints_On_Kill
|
if (Context.User is Player player) //Hitpoints_On_Kill
|
||||||
if (Context.User.Attributes[GameAttribute.Hitpoints_On_Kill] > 0)
|
if (player.Attributes[GameAttribute.Hitpoints_On_Kill] > 0)
|
||||||
(Context.User as Player).AddHP(Context.User.Attributes[GameAttribute.Hitpoints_On_Kill]);
|
player.AddHP(player.Attributes[GameAttribute.Hitpoints_On_Kill]);
|
||||||
|
|
||||||
// HACK: add to hackish list thats used to defer deleting actor and filter it from powers targetting
|
// HACK: add to hackish list thats used to defer deleting actor and filter it from powers targetting
|
||||||
if (!(Target is Boss))
|
if (!(Target is Boss))
|
||||||
Target.World.PowerManager.AddDeletingActor(Target);
|
Target.World.PowerManager.AddDeletingActor(Target);
|
||||||
|
|
||||||
if (Target is Living)
|
if (Target is Living actor)
|
||||||
{
|
{
|
||||||
Living actor = (Living)Target;
|
|
||||||
if (actor.Brain != null)
|
if (actor.Brain != null)
|
||||||
actor.Brain.Kill();
|
actor.Brain.Kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Target is Monster)
|
if (Target is Monster target)
|
||||||
{
|
{
|
||||||
|
if (target.Brain != null)
|
||||||
|
target.Brain.Kill();
|
||||||
|
|
||||||
Monster mon = (Monster)Target;
|
target.World.BroadcastIfRevealed(plr => new ACDCollFlagsMessage
|
||||||
if (mon.Brain != null)
|
|
||||||
mon.Brain.Kill();
|
|
||||||
|
|
||||||
mon.World.BroadcastIfRevealed(plr => new ACDCollFlagsMessage
|
|
||||||
{
|
{
|
||||||
ActorID = mon.DynamicID(plr),
|
ActorID = target.DynamicID(plr),
|
||||||
CollFlags = 0
|
CollFlags = 0
|
||||||
}, mon);
|
}, target);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Target is Minion)
|
if (Target is Minion minionTarget)
|
||||||
{
|
{
|
||||||
Minion mon = (Minion)Target;
|
if (minionTarget.Master != null && minionTarget.Master is Player)
|
||||||
if (mon.Master != null && mon.Master is Player)
|
|
||||||
{
|
{
|
||||||
(mon.Master as Player).Followers.Remove(Target.GlobalID);
|
(minionTarget.Master as Player).Followers.Remove(minionTarget.GlobalID);
|
||||||
(mon.Master as Player).FreeFollowerIndex(mon.SNO);
|
(minionTarget.Master as Player).FreeFollowerIndex(minionTarget.SNO);
|
||||||
}
|
}
|
||||||
if (mon.Brain != null)
|
if (minionTarget.Brain != null)
|
||||||
mon.Brain.Kill();
|
minionTarget.Brain.Kill();
|
||||||
|
|
||||||
LootAndExp = false;
|
LootAndExp = false;
|
||||||
}
|
}
|
||||||
bool championsAlive = false;
|
|
||||||
|
|
||||||
if (Target is Champion)
|
if (Target is Champion)
|
||||||
{
|
{
|
||||||
championsAlive = Target.GetActorsInRange<Champion>(1000).Where(c => c.GroupId == Target.GroupId && c.Attributes[GameAttribute.Hitpoints_Cur] > 0).ToList().Count > 0;
|
bool championsAlive = Target.GetActorsInRange<Champion>(1000).Where(c => c.GroupId == Target.GroupId && c.Attributes[GameAttribute.Hitpoints_Cur] > 0).ToList().Count > 0;
|
||||||
if (championsAlive)
|
if (championsAlive)
|
||||||
LootAndExp = false;
|
LootAndExp = false;
|
||||||
}
|
}
|
||||||
@ -309,10 +295,10 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
Field3 = true
|
Field3 = true
|
||||||
}, Target);
|
}, Target);
|
||||||
|
|
||||||
if (Context != null)
|
if (Context?.User != null)
|
||||||
if (Context.User.Attributes[GameAttribute.Item_Power_Passive, 247640] == 1 ||
|
if (Math.Abs(Context.User.Attributes[GameAttribute.Item_Power_Passive, 247640] - 1) < 0.001 ||
|
||||||
Context.User.Attributes[GameAttribute.Item_Power_Passive, 249963] == 1 ||
|
Math.Abs(Context.User.Attributes[GameAttribute.Item_Power_Passive, 249963] - 1) < 0.001 ||
|
||||||
Context.User.Attributes[GameAttribute.Item_Power_Passive, 249954] == 1 ||
|
Math.Abs(Context.User.Attributes[GameAttribute.Item_Power_Passive, 249954] - 1) < 0.001 ||
|
||||||
(float)FastRandom.Instance.NextDouble() < 0.1f ||
|
(float)FastRandom.Instance.NextDouble() < 0.1f ||
|
||||||
Target.World.SNO == WorldSno.a1dun_random_level01)
|
Target.World.SNO == WorldSno.a1dun_random_level01)
|
||||||
switch ((int)DeathDamageType.HitEffect)
|
switch ((int)DeathDamageType.HitEffect)
|
||||||
@ -327,14 +313,14 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Context != null)
|
if (Context != null)
|
||||||
if (Context.User is Player && Math.Abs(Context.User.Attributes[GameAttribute.Level] - Target.Attributes[GameAttribute.Level]) < 5)
|
if (Context.User is Player player && Math.Abs(player.Attributes[GameAttribute.Level] - Target.Attributes[GameAttribute.Level]) < 5)
|
||||||
(Context.User as Player).KilledSeasonalTempCount++;
|
player.KilledSeasonalTempCount++;
|
||||||
|
|
||||||
if (Context.User is Player)
|
if (Context?.User is Player plr2)
|
||||||
if (Context.World.BuffManager.HasBuff<LandOfDead.ZBuff>(Context.User))
|
if (Context.World.BuffManager.HasBuff<LandOfDead.ZBuff>(Context.User))
|
||||||
{
|
{
|
||||||
(Context.User as Player).BuffStreakKill += 1;
|
plr2.BuffStreakKill += 1;
|
||||||
if ((Context.User as Player).BuffStreakKill == 10 || (Context.User as Player).BuffStreakKill == 20)
|
if (plr2.BuffStreakKill == 10 || plr2.BuffStreakKill == 20)
|
||||||
{
|
{
|
||||||
//(this.Context.User as Player).Attributes[_Buff_Icon_End_TickN, PowerSNO]
|
//(this.Context.User as Player).Attributes[_Buff_Icon_End_TickN, PowerSNO]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
user.block.title