public static Boolean Evaluate(Object state, ref Boolean error) { Combat.Character character = state as Combat.Character; if (character == null) { error = true; return(false); } foreach (Combat.Entity entity in character.Engine.Entities) { Combat.Character opp = character.FilterEntityAsCharacter(entity, AffectTeam.Enemy); if (opp != null && opp.OffensiveInfo.ActiveHitDef == true && InGuardDistance(opp.OffensiveInfo.HitDef, opp, character) == true) { return(true); } Combat.Projectile projectile = entity as Combat.Projectile; if (projectile != null && projectile.Team != character.Team && InGuardDistance(projectile.Data.HitDef, projectile, character) == true) { return(true); } } return(false); }
public static Int32 Evaluate(Object state, ref Boolean error) { Combat.Character character = state as Combat.Character; if (character == null) { error = true; return(0); } Int32 count = 0; foreach (Combat.Entity entity in character.Engine.Entities) { Combat.Projectile projectile = character.FilterEntityAsProjectile(entity, Int32.MinValue); if (projectile == null) { continue; } ++count; } return(count); }
public override void Run(Combat.Character character) { Combat.ProjectileData data = new Combat.ProjectileData(); if (HitAttribute != null) { data.HitDef = new Combat.HitDefinition(); SetHitDefinition(character, data.HitDef); } data.ProjectileId = EvaluationHelper.AsInt32(character, ProjectileId, 0); data.AnimationNumber = EvaluationHelper.AsInt32(character, ProjectileAnimationNumber, 0); data.HitAnimationNumber = EvaluationHelper.AsInt32(character, ProjectileHitAnimationNumber, -1); data.RemoveAnimationNumber = EvaluationHelper.AsInt32(character, ProjectileRemoveAnimationNumber, data.HitAnimationNumber); data.CancelAnimationNumber = EvaluationHelper.AsInt32(character, ProjectileRemoveAnimationNumber, data.RemoveAnimationNumber); data.Scale = EvaluationHelper.AsVector2(character, ProjectileScale, Vector2.One); data.RemoveOnHit = EvaluationHelper.AsBoolean(character, ProjectileRemoveOnHit, true); data.RemoveTimeout = EvaluationHelper.AsInt32(character, ProjectileRemoveTime, -1); data.InitialVelocity = EvaluationHelper.AsVector2(character, ProjectileVelocity, Vector2.Zero); data.RemoveVelocity = EvaluationHelper.AsVector2(character, ProjectileRemoveVelocity, Vector2.Zero); data.Acceleration = EvaluationHelper.AsVector2(character, ProjectileAcceleration, Vector2.Zero); data.VelocityMultiplier = EvaluationHelper.AsVector2(character, ProjectileVelocityMultiplier, Vector2.One); data.HitsBeforeRemoval = EvaluationHelper.AsInt32(character, ProjectileHits, 1); data.TimeBetweenHits = EvaluationHelper.AsInt32(character, ProjectileMissTime, 0); data.Priority = EvaluationHelper.AsInt32(character, ProjectilePriority, 1); data.SpritePriority = EvaluationHelper.AsInt32(character, ProjectileSpritePriority, 3); data.ScreenEdgeBound = EvaluationHelper.AsInt32(character, ProjectileScreenBound, 40); data.StageEdgeBound = EvaluationHelper.AsInt32(character, ProjectileStageBound, 40); Point heightbounds = EvaluationHelper.AsPoint(character, ProjectileHeightBound, new Point(-240, 1)); data.HeightLowerBound = heightbounds.X; data.HeightUpperBound = heightbounds.Y; data.CreationOffset = (Vector2)EvaluationHelper.AsPoint(character, ProjectileCreationOffset, new Point(0, 0)); data.PositionType = ProjectileCreationPositionType; data.ShadowColor = new Color(EvaluationHelper.AsVector3(character, ProjectileShadow, Vector3.Zero)); data.SuperPauseMoveTime = EvaluationHelper.AsInt32(character, ProjectileSuperPauseTime, 0); data.PauseMoveTime = EvaluationHelper.AsInt32(character, ProjectilePauseTime, 0); data.AfterImageTime = EvaluationHelper.AsInt32(character, ProjectileAfterImageTime, 1); data.AfterImageNumberOfFrames = EvaluationHelper.AsInt32(character, ProjectileAfterImageNumberOfFrames, 20); Int32 basecolor = EvaluationHelper.AsInt32(character, ProjectileAfterImagePaletteColor, 255); data.AfterImageBaseColor = Vector3.Clamp(new Vector3(basecolor) / 255.0f, Vector3.Zero, Vector3.One); data.AfterImageInvertColor = EvaluationHelper.AsBoolean(character, ProjectileAfterImagePaletteColorInversion, false); Vector3 brightness = EvaluationHelper.AsVector3(character, ProjectileAfterImagePaletteColorBrightness, new Vector3(30, 30, 30)); data.AfterImagePreAddColor = Vector3.Clamp(brightness / 255.0f, Vector3.Zero, Vector3.One); Vector3 contrast = EvaluationHelper.AsVector3(character, ProjectileAfterImagePaletteColorContrast, new Vector3(255, 255, 255)); data.AfterImageConstrast = Vector3.Clamp(contrast / 255.0f, Vector3.Zero, new Vector3(Single.MaxValue)); Vector3 postcolor = EvaluationHelper.AsVector3(character, ProjectileAfterImagePalettePostBrightness, new Vector3(0, 0, 0)); data.AfterImagePostAddColor = Vector3.Clamp(postcolor / 255.0f, Vector3.Zero, Vector3.One); Vector3 coloradd = EvaluationHelper.AsVector3(character, ProjectileAfterImagePaletteColorAdd, new Vector3(10, 10, 25)); data.AfterImagePaletteColorAdd = Vector3.Clamp(coloradd / 255.0f, Vector3.Zero, Vector3.One); Vector3 colormul = EvaluationHelper.AsVector3(character, ProjectileAfterImagePaletteColorMultiply, new Vector3(.65f, .65f, .75f)); data.AfterImagePaletteColorMul = Vector3.Clamp(colormul, Vector3.Zero, new Vector3(Single.MaxValue)); data.AfterImageTimeGap = EvaluationHelper.AsInt32(character, ProjectileAfterImageTimeGap, 1); data.AfterImageFrameGap = EvaluationHelper.AsInt32(character, ProjectileAfterImageFrameGap, 4); data.AfterImageTransparency = ProjectileAfterImageTransparency; Combat.Projectile projectile = new Combat.Projectile(character.Engine, character, data); projectile.Engine.Entities.Add(projectile); }