public void BehaviorAsAoE(Projectile projectile) { var config = DestructibleTilesConfig.Instance; var projDef = new ProjectileDefinition(projectile.type); ProjectileStateDefinition projExploDef = config.ProjectilesAsAoE[projDef]; if (!projExploDef.IsProjectileMatch(projectile)) { return; } int tileX = (int)projectile.position.X >> 4; int tileY = (int)projectile.position.Y >> 4; int damage = DestructibleTilesProjectile.ComputeProjectileDamage(projectile); if (config.DebugModeInfo) { Main.NewText("RADIUS - " + projDef.ToString() + ", radius:" + projExploDef.Amount + ", damage:" + damage); } DestructibleTilesProjectile.HitTilesInRadius(tileX, tileY, projExploDef.Amount, damage); }
private static void CanHitTilesAgain( Projectile projectile, ProjectileDefinition projDef, string timerName, ref bool isHit) { var config = DestructibleTilesConfig.Instance; ProjectileStateDefinition projConsec = config.ProjectilesAsConsecutiveHitters[projDef]; if (!projConsec.IsProjectileMatch(projectile)) { return; } string repeatTimerName = timerName + "_repeat"; int cooldown = config.ProjectilesAsConsecutiveHitters[projDef].Amount; if (Timers.GetTimerTickDuration(repeatTimerName) <= 0) { Timers.SetTimer(repeatTimerName, cooldown, false, () => false); isHit = false; } }
public static int ComputeProjectileDamage(Projectile projectile) { var config = DestructibleTilesConfig.Instance; var projDef = new ProjectileDefinition(projectile.type); if (projectile.minion && config.MinionsCannotHitTiles) { return(0); } if (config.ProjectileTileDamageUltimate.ContainsKey(projDef)) { ProjectileStateDefinition projDmgOver = config.ProjectileTileDamageUltimate[projDef]; if (projDmgOver.IsProjectileMatch(projectile)) { return(projDmgOver.Amount); } } if (projectile.damage > 0) { return((int)((float)projectile.damage * config.AllDamagesScale)); } if (config.ProjectileTileDamageDefaults.ContainsKey(projDef)) { ProjectileStateDefinition projDmgDef = config.ProjectileTileDamageDefaults[projDef]; if (projDmgDef.IsProjectileMatch(projectile)) { return((int)((float)projDmgDef.Amount * config.AllDamagesScale)); } } return((int)((float)projectile.damage * config.AllDamagesScale)); }