public override void Run(Combat.Character character) { SoundId?soundid = EvaluationHelper.AsSoundId(character, SoundId, null); Int32 volume = EvaluationHelper.AsInt32(character, Volume, 0); Int32 channelindex = EvaluationHelper.AsInt32(character, ChannelNumber, -1); Boolean priority = EvaluationHelper.AsBoolean(character, ChannelPriority, false); Single frequencymultiplier = EvaluationHelper.AsSingle(character, FrequencyMultiplier, 1.0f); Boolean loop = EvaluationHelper.AsBoolean(character, LoopSound, false); Int32? pan = EvaluationHelper.AsInt32(character, PanSound, null); Int32? abspan = EvaluationHelper.AsInt32(character, PanSoundAbsolute, null); if (soundid == null) { return; } Audio.SoundManager soundmanager = SoundId.IsCommon(false) ? character.Engine.CommonSounds : character.SoundManager; Audio.Channel channel = soundmanager.Play(channelindex, soundid.Value, priority, volume, frequencymultiplier, loop); if (channel != null && pan != null) { channel.RelativePan(pan.Value); } if (channel != null && abspan != null) { channel.AbsolutePan(abspan.Value); } }
public override void Run(Combat.Character character) { int?time = EvaluationHelper.AsInt32(character, Time, 30); var buffertime = EvaluationHelper.AsInt32(character, EndCommandBufferTime, 0); var movetime = EvaluationHelper.AsInt32(character, MoveTime, 0); var pausebg = EvaluationHelper.AsBoolean(character, PauseBackgrounds, true); var power = EvaluationHelper.AsInt32(character, PowerAdd, 0); #warning Documentation states that default should be 30. Testing looks to be 100. var animationnumber = EvaluationHelper.AsInt32(character, AnimationNumber, 100); var soundid = EvaluationHelper.AsSoundId(character, SoundId, null); var animationposition = EvaluationHelper.AsPoint(character, AnimationPosition, new Point(0, 0)); var darkenscreen = EvaluationHelper.AsBoolean(character, DarkenScreen, true); var p2defmul = EvaluationHelper.AsSingle(character, P2DefenseMultiplier, null); var unhittable = EvaluationHelper.AsBoolean(character, Unhittable, true); if (time == null) { return; } var pause = character.Engine.SuperPause; pause.Set(character, time.Value, buffertime, movetime, false, pausebg); character.BasePlayer.Power += power; var data = new Combat.ExplodData(); data.PositionType = PositionType.P1; data.Location = (Vector2)animationposition; data.RemoveTime = -2; data.CommonAnimation = EvaluationHelper.IsCommon(AnimationNumber, true); data.AnimationNumber = animationnumber; data.Scale = Vector2.One; data.SuperMove = true; data.Creator = character; data.Offseter = character; data.DrawOnTop = true; var explod = new Combat.Explod(character.Engine, data); if (explod.IsValid) { explod.Engine.Entities.Add(explod); } if (soundid != null) { Audio.SoundManager soundmanager = SoundId.IsCommon(true) ? character.Engine.CommonSounds : character.SoundManager; soundmanager.Play(soundid.Value); } }
protected void SetHitDefinition(Combat.Character character, Combat.HitDefinition hitdef) { if (character == null) { throw new ArgumentNullException(nameof(character)); } if (hitdef == null) { throw new ArgumentNullException(nameof(hitdef)); } var defaulthitspark = EvaluationHelper.AsInt32(character, character.BasePlayer.Constants.DefaultSparkNumber, -1); var defaultplayerhitspark = !EvaluationHelper.IsCommon(character.BasePlayer.Constants.DefaultSparkNumber, true); var defaultguardspark = EvaluationHelper.AsInt32(character, character.BasePlayer.Constants.DefaultGuardSparkNumber, -1); var defaultplayerguardspark = !EvaluationHelper.IsCommon(character.BasePlayer.Constants.DefaultGuardSparkNumber, true); hitdef.HitAttribute = HitAttribute; hitdef.HitFlag = HitFlag; hitdef.GuardFlag = GuardFlag; hitdef.Targeting = Targetting; hitdef.GroundAnimationType = HitAnimationType; hitdef.AirAnimationType = AirHitAnimationType; hitdef.FallAnimationType = FallHitAnimationType; hitdef.HitPriority = Priority; var damage = EvaluationHelper.AsPoint(character, Damage, new Point(0, 0)); hitdef.HitDamage = damage.X; hitdef.GuardDamage = damage.Y; var pauseshaketime = EvaluationHelper.AsPoint(character, PauseTime, new Point(0, 0)); hitdef.PauseTime = pauseshaketime.X; hitdef.ShakeTime = pauseshaketime.Y; var guardpauseshaketime = EvaluationHelper.AsPoint(character, GuardPauseTime, pauseshaketime); hitdef.GuardPauseTime = guardpauseshaketime.X; hitdef.GuardShakeTime = guardpauseshaketime.Y; hitdef.PlayerSpark = !EvaluationHelper.IsCommon(SparkNumber, !defaultplayerhitspark); hitdef.SparkAnimation = EvaluationHelper.AsInt32(character, SparkNumber, defaulthitspark); hitdef.GuardPlayerSpark = !EvaluationHelper.IsCommon(GuardSparkNumber, !defaultplayerguardspark); hitdef.GuardSparkAnimation = EvaluationHelper.AsInt32(character, GuardSparkNumber, defaultguardspark); hitdef.SparkStartPosition = (Vector2)EvaluationHelper.AsPoint(character, SparkPosition, new Point(0, 0)); hitdef.PlayerSound = !EvaluationHelper.IsCommon(HitSound, true); hitdef.HitSoundId = EvaluationHelper.AsSoundId(character, HitSound, SoundId.Invalid); hitdef.GuardPlayerSound = !EvaluationHelper.IsCommon(GuardHitSound, true); hitdef.GuardSoundId = EvaluationHelper.AsSoundId(character, GuardHitSound, SoundId.Invalid); hitdef.GroundAttackEffect = GroundAttackEffect; hitdef.AirAttackEffect = AirAttackEffect; hitdef.GroundHitTime = EvaluationHelper.AsInt32(character, GroundHitTime, 0); hitdef.DownHitTime = EvaluationHelper.AsInt32(character, DownHitTime, 0); hitdef.GuardHitTime = EvaluationHelper.AsInt32(character, GuardHitTime, hitdef.GroundHitTime); hitdef.AirHitTime = EvaluationHelper.AsInt32(character, AirHitTime, 20); hitdef.GroundSlideTime = EvaluationHelper.AsInt32(character, GroundSlideTime, 0); hitdef.GuardSlideTime = EvaluationHelper.AsInt32(character, GroundSlideTime, hitdef.GuardHitTime); hitdef.GuardControlTime = EvaluationHelper.AsInt32(character, GuardControlTime, hitdef.GuardSlideTime); hitdef.AirGuardControlTime = EvaluationHelper.AsInt32(character, AirGuardControlTime, hitdef.GuardControlTime); hitdef.GuardDistance = EvaluationHelper.AsInt32(character, GuardDistance, character.BasePlayer.Constants.Attackdistance); hitdef.YAcceleration = EvaluationHelper.AsSingle(character, VerticalAcceleration, 0.35f); hitdef.GroundVelocity = EvaluationHelper.AsVector2(character, GroundVelocity, Vector2.Zero); hitdef.GroundGuardVelocity = new Vector2(EvaluationHelper.AsSingle(character, GuardVelocity, hitdef.GroundVelocity.X), 0); hitdef.AirVelocity = EvaluationHelper.AsVector2(character, AirVelocity, Vector2.Zero); hitdef.DownVelocity = EvaluationHelper.AsVector2(character, DownVelocity, hitdef.AirVelocity); hitdef.AirGuardVelocity = EvaluationHelper.AsVector2(character, AirGuardVelocity, hitdef.AirVelocity * new Vector2(1.5f, 0.5f)); hitdef.GroundCornerPush = EvaluationHelper.AsSingle(character, GroundCornerPushOff, hitdef.HitAttribute.HasHeight(AttackStateType.Air) ? 0.0f : hitdef.GroundGuardVelocity.X * 1.3f); hitdef.AirCornerPush = EvaluationHelper.AsSingle(character, AirCornerPushOff, hitdef.GroundCornerPush); hitdef.DownCornerPush = EvaluationHelper.AsSingle(character, DownCornerPushOff, hitdef.GroundCornerPush); hitdef.GuardCornerPush = EvaluationHelper.AsSingle(character, GuardCornerPushOff, hitdef.GroundCornerPush); hitdef.AirGuardCornerPush = EvaluationHelper.AsSingle(character, AirGuardCornerPushOff, hitdef.GroundCornerPush); hitdef.JugglePointsNeeded = EvaluationHelper.AsInt32(character, JugglePointsNeeded, 0); hitdef.MininumDistance = EvaluationHelper.AsPoint(character, MinimumDistance, null); hitdef.MaximumDistance = EvaluationHelper.AsPoint(character, MaximumDistance, null); hitdef.SnapLocation = EvaluationHelper.AsPoint(character, Snap, null); hitdef.P1SpritePriority = EvaluationHelper.AsInt32(character, P1SpritePriority, 1); hitdef.P2SpritePriority = EvaluationHelper.AsInt32(character, P2SpritePriority, 0); hitdef.P1Facing = EvaluationHelper.AsInt32(character, P1Facing, 0); hitdef.P1GetP2Facing = EvaluationHelper.AsInt32(character, P1GetP2Facing, 0); hitdef.P2Facing = EvaluationHelper.AsInt32(character, P2Facing, 0); hitdef.P1NewState = EvaluationHelper.AsInt32(character, P1StateNumber, null); hitdef.P2NewState = EvaluationHelper.AsInt32(character, P2StateNumber, null); hitdef.P2UseP1State = EvaluationHelper.AsBoolean(character, P2GetP1StateNumber, true); hitdef.ForceStand = EvaluationHelper.AsBoolean(character, ForceStand, hitdef.GroundVelocity.Y != 0 ? true : false); hitdef.Fall = EvaluationHelper.AsBoolean(character, Fall, false); hitdef.AirFall = EvaluationHelper.AsBoolean(character, AirFall, hitdef.Fall); hitdef.FallVelocityX = EvaluationHelper.AsSingle(character, FallXVelocity, null); hitdef.FallVelocityY = EvaluationHelper.AsSingle(character, FallYVelocity, -4.5f); hitdef.FallCanRecover = EvaluationHelper.AsBoolean(character, FallCanRecover, true); hitdef.FallRecoverTime = EvaluationHelper.AsInt32(character, FallRecoverTime, 4); hitdef.FallDamage = EvaluationHelper.AsInt32(character, FallDamage, 0); hitdef.DownBounce = EvaluationHelper.AsBoolean(character, DownBounce, false); hitdef.TargetId = EvaluationHelper.AsInt32(character, TargetId, 0); hitdef.ChainId = EvaluationHelper.AsInt32(character, ChainId, -1); var nochainid = EvaluationHelper.AsPoint(character, NoChainId, new Point(-1, -1)); hitdef.NoChainId1 = nochainid.X; hitdef.NoChainId2 = nochainid.Y; hitdef.HitOnce = EvaluationHelper.AsBoolean(character, HitOnce, hitdef.HitAttribute.HasData(new Combat.HitType(AttackClass.Throw, AttackPower.All)) ? true : false); hitdef.CanKill = EvaluationHelper.AsBoolean(character, CanKill, true); hitdef.CanGuardKill = EvaluationHelper.AsBoolean(character, CanGuardKill, true); hitdef.CanFallKill = EvaluationHelper.AsBoolean(character, CanFallKill, true); hitdef.NumberOfHits = EvaluationHelper.AsInt32(character, NumberOfHits, 1); if (P1PowerIncrease != null) { var statepower = P1PowerIncrease.Evaluate(character); if (statepower.Length > 0 && statepower[0].NumberType != NumberType.None) { hitdef.P1HitPowerAdjustment = statepower[0].IntValue; } else { hitdef.P1HitPowerAdjustment = (int)(hitdef.HitDamage * 0.7f); } if (statepower.Length > 1 && statepower[1].NumberType != NumberType.None) { hitdef.P1GuardPowerAdjustment = statepower[1].IntValue; } else { hitdef.P1GuardPowerAdjustment = (int)(hitdef.P1HitPowerAdjustment * 0.5f); } } if (P2PowerIncrease != null) { var p2power = P2PowerIncrease.Evaluate(character); if (p2power.Length > 0 && p2power[0].NumberType != NumberType.None) { hitdef.P2HitPowerAdjustment = p2power[0].IntValue; } else { hitdef.P2HitPowerAdjustment = (int)(hitdef.HitDamage * 0.6f); } if (p2power.Length > 1 && p2power[1].NumberType != NumberType.None) { hitdef.P2GuardPowerAdjustment = p2power[1].IntValue; } else { hitdef.P2GuardPowerAdjustment = (int)(hitdef.P2HitPowerAdjustment * 0.5f); } } hitdef.PalFxTime = EvaluationHelper.AsInt32(character, PaletteColorTime, 0); hitdef.PalFxAdd = EvaluationHelper.AsVector3(character, PaletteColorAdd, new Vector3(0, 0, 0)); hitdef.PalFxMul = EvaluationHelper.AsVector3(character, PaletteColorMultiply, new Vector3(255, 255, 255)); hitdef.PalFxBaseColor = EvaluationHelper.AsInt32(character, PaletteColor, 255) / 255.0f; hitdef.PalFxInvert = EvaluationHelper.AsBoolean(character, PaletteColorInversion, false); hitdef.PalFxSinAdd = EvaluationHelper.AsVector4(character, PaletteColorSineAdd, new Vector4(0, 0, 0, 1)); hitdef.EnvShakeTime = EvaluationHelper.AsInt32(character, ShakeTime, 0); hitdef.EnvShakeFrequency = Misc.Clamp(EvaluationHelper.AsSingle(character, ShakeFrequency, 60), 0, 180); hitdef.EnvShakeAmplitude = EvaluationHelper.AsInt32(character, ShakeAmplitude, -4); hitdef.EnvShakePhase = EvaluationHelper.AsSingle(character, ShakePhaseOffset, hitdef.EnvShakeFrequency >= 90 ? 0 : 90); hitdef.EnvShakeFallTime = EvaluationHelper.AsInt32(character, FallShakeTime, 0); hitdef.EnvShakeFallFrequency = Misc.Clamp(EvaluationHelper.AsSingle(character, FallShakeFrequency, 60), 0, 180); hitdef.EnvShakeFallAmplitude = EvaluationHelper.AsInt32(character, FallShakeAmplitude, -4); hitdef.EnvShakeFallPhase = EvaluationHelper.AsSingle(character, FallShakePhaseOffset, hitdef.EnvShakeFallFrequency >= 90 ? 0 : 90); }