public static ProjectileMagi Create(MagiShield magiShield, GameObject actor, byte subType, byte numberOfBalls, byte ballNumber, byte radius, short regenFrames = 0) { ProjectileMagi projectile = new ProjectileMagi(); projectile.ResetMagiBall(magiShield, actor, subType, numberOfBalls, ballNumber, radius, regenFrames); return(projectile); }
public virtual bool RunProjectileImpact(Projectile projectile) { // Can only be damaged if the projectile was cast by a Character. if (projectile.ByCharacterId == 0) { return(false); } // Special behavior for Magi-Balls. Projectiles faded out don't function. if (projectile is ProjectileMagi) { ProjectileMagi magi = (ProjectileMagi)projectile; if (!magi.CanDamage) { return(false); } } // Check if the enemy is resistant to the projectile. In most cases, destroy the projectile without harming the enemy. bool canResist = this.CanResistDamage(projectile.Damage); // If the projectile typicallly passes through walls, allow it to pass through indestructable enemies. if (canResist && projectile.CollisionType <= ProjectileCollisionType.IgnoreWallsDestroy) { return(false); } DirCardinal dir = CollideDetect.GetDirectionOfCollision(projectile, this); // Destroy the Projectile (unless it ignores walls) if (projectile.CollisionType != ProjectileCollisionType.IgnoreWallsSurvive || projectile is ProjectileMagi) { projectile.Destroy(dir); } // Wound the Enemy if (!canResist) { this.ReceiveWound(); } return(true); }