Sets a default parameter for OnHit. More casting cleanup.
This commit is contained in:
parent
74f498c1c8
commit
d6c0bf2d4c
96 changed files with 350 additions and 579 deletions
|
|
@ -35,7 +35,7 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
|
||||
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus = 1 )
|
||||
{
|
||||
base.OnHit( attacker, defender, damageBonus );
|
||||
|
||||
|
|
|
|||
|
|
@ -68,10 +68,8 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object targ )
|
||||
{
|
||||
if ( targ is BaseCreature )
|
||||
if ( targ is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)targ;
|
||||
|
||||
if ( IsHerdable( bc ) )
|
||||
{
|
||||
if ( bc.Controlled )
|
||||
|
|
@ -114,9 +112,7 @@ namespace Server.Items
|
|||
|
||||
Map map = bc.Map;
|
||||
|
||||
ChampionSpawnRegion region = Region.Find( bc.Home, map ) as ChampionSpawnRegion;
|
||||
|
||||
if ( region != null )
|
||||
if ( Region.Find( bc.Home, map ) is ChampionSpawnRegion region )
|
||||
{
|
||||
ChampionSpawn spawn = region.ChampionSpawn;
|
||||
|
||||
|
|
@ -144,7 +140,7 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object targ )
|
||||
{
|
||||
if ( targ is IPoint2D )
|
||||
if ( targ is IPoint2D p )
|
||||
{
|
||||
double min = m_Creature.MinTameSkill - 30;
|
||||
double max = m_Creature.MinTameSkill + 30 + Utility.Random( 10 );
|
||||
|
|
@ -154,9 +150,7 @@ namespace Server.Items
|
|||
|
||||
if ( from.CheckTargetSkill( SkillName.Herding, m_Creature, min, max ) )
|
||||
{
|
||||
IPoint2D p = (IPoint2D) targ;
|
||||
|
||||
if ( targ != from )
|
||||
if ( p != from )
|
||||
p = new Point2D( p.X, p.Y );
|
||||
|
||||
m_Creature.TargetLocation = p;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue