Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        Combat.ModifyExplodData CreateModifyExplodData(Combat.Character character)
        {
            if (character == null)
            {
                throw new ArgumentNullException("character");
            }

            Int32?  animationnumber = EvaluationHelper.AsInt32(character, AnimationNumber, null);
            Int32?  id                 = EvaluationHelper.AsInt32(character, Id, null);
            Point?  location           = EvaluationHelper.AsPoint(character, Position, null);
            Int32?  horizfacing        = EvaluationHelper.AsInt32(character, Facing, null);
            Int32?  vertfacing         = EvaluationHelper.AsInt32(character, VerticalFacing, null);
            Int32?  bindtime           = EvaluationHelper.AsInt32(character, BindTime, null);
            Vector2?velocity           = EvaluationHelper.AsVector2(character, Velocity, null);
            Vector2?acceleration       = EvaluationHelper.AsVector2(character, Acceleration, null);
            Point?  randomdisplacement = EvaluationHelper.AsPoint(character, RandomDisplacement, null);
            Int32?  removetime         = EvaluationHelper.AsInt32(character, RemoveTime, null);
            Boolean?supermove          = EvaluationHelper.AsBoolean(character, Supermove, null);
            Int32?  supermovetime      = EvaluationHelper.AsInt32(character, SupermoveTime, null);
            Int32?  pausetime          = EvaluationHelper.AsInt32(character, PauseMoveTime, null);
            Vector2?scale              = EvaluationHelper.AsVector2(character, Scale, null);
            Int32?  spritepriority     = EvaluationHelper.AsInt32(character, SpritePriority, null);
            Boolean?ontop              = EvaluationHelper.AsBoolean(character, DrawOnTop, null);
            Boolean?ownpalette         = EvaluationHelper.AsBoolean(character, OwnPalette, null);
            Boolean?removeongethit     = EvaluationHelper.AsBoolean(character, RemoveOnGetHit, null);
            Boolean?ignorehitpause     = EvaluationHelper.AsBoolean(character, ExplodIgnoreHitPause, null);
            Point?  alpha              = EvaluationHelper.AsPoint(character, Alpha, null);

            if (id == null)
            {
                return(null);
            }

            SpriteEffects?flip = null;

            if (horizfacing != null || vertfacing != null)
            {
                flip = SpriteEffects.None;
            }

            if (horizfacing == -1)
            {
                flip ^= SpriteEffects.FlipHorizontally;
            }
            if (vertfacing == -1)
            {
                flip ^= SpriteEffects.FlipVertically;
            }

            Blending?transparency = Transparency;

            if (transparency != null && transparency.Value.BlendType == BlendType.Add && transparency.Value.SourceFactor == 0 && transparency.Value.DestinationFactor == 0)
            {
                if (alpha != null)
                {
                    transparency = new Blending(BlendType.Add, alpha.Value.X, alpha.Value.Y);
                }
                else
                {
                    transparency = new Blending();
                }
            }

            Combat.ModifyExplodData data = new Combat.ModifyExplodData();
            data.CommonAnimation = EvaluationHelper.IsCommon(AnimationNumber, false);
            data.AnimationNumber = animationnumber;
            data.Id             = id.Value;
            data.RemoveTime     = removetime;
            data.Location       = (Vector2?)location;
            data.PositionType   = PositionType;
            data.Velocity       = velocity;
            data.Acceleration   = acceleration;
            data.Flip           = flip;
            data.BindTime       = bindtime;
            data.Random         = randomdisplacement;
            data.SuperMove      = supermove;
            data.SuperMoveTime  = supermovetime;
            data.PauseTime      = pausetime;
            data.Scale          = scale;
            data.SpritePriority = spritepriority;
            data.DrawOnTop      = ontop;
            data.OwnPalFx       = ownpalette;
            data.RemoveOnGetHit = removeongethit;
            data.IgnoreHitPause = ignorehitpause;
            data.Transparency   = transparency;

            return(data);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        private Combat.ExplodData CreateExplodData(Combat.Character character)
        {
            if (character == null)
            {
                throw new ArgumentNullException(nameof(character));
            }

            var animationnumber = EvaluationHelper.AsInt32(character, AnimationNumber, null);
            var id                 = EvaluationHelper.AsInt32(character, Id, -1);
            var location           = EvaluationHelper.AsPoint(character, Position, new Point(0, 0));
            var horizfacing        = EvaluationHelper.AsInt32(character, Facing, 1);
            var vertfacing         = EvaluationHelper.AsInt32(character, VerticalFacing, 1);
            var bindtime           = EvaluationHelper.AsInt32(character, BindTime, 0);
            var velocity           = EvaluationHelper.AsVector2(character, Velocity, new Vector2(0, 0));
            var acceleration       = EvaluationHelper.AsVector2(character, Acceleration, new Vector2(0, 0));
            var randomdisplacement = EvaluationHelper.AsPoint(character, RandomDisplacement, new Point(0, 0));
            var removetime         = EvaluationHelper.AsInt32(character, RemoveTime, -2);
            var supermove          = EvaluationHelper.AsBoolean(character, Supermove, false);
            var supermovetime      = EvaluationHelper.AsInt32(character, SupermoveTime, 0);
            var pausetime          = EvaluationHelper.AsInt32(character, PauseMoveTime, 0);
            var scale              = EvaluationHelper.AsVector2(character, Scale, new Vector2(1, 1));
            var spritepriority     = EvaluationHelper.AsInt32(character, SpritePriority, 0);
            var ontop              = EvaluationHelper.AsBoolean(character, DrawOnTop, false);
            var ownpalette         = EvaluationHelper.AsBoolean(character, OwnPalette, false);
            var removeongethit     = EvaluationHelper.AsBoolean(character, RemoveOnGetHit, false);
            var ignorehitpause     = EvaluationHelper.AsBoolean(character, ExplodIgnoreHitPause, true);
            var alpha              = EvaluationHelper.AsPoint(character, Alpha, null);

            if (animationnumber == null)
            {
                return(null);
            }

            var flip = SpriteEffects.None;

            if (horizfacing == -1)
            {
                flip ^= SpriteEffects.FlipHorizontally;
            }
            if (vertfacing == -1)
            {
                flip ^= SpriteEffects.FlipVertically;
            }

            var transparency = Transparency;

            if (transparency.BlendType == BlendType.Add && transparency.SourceFactor == 0 && transparency.DestinationFactor == 0)
            {
                if (alpha != null)
                {
                    transparency = new Blending(BlendType.Add, alpha.Value.X, alpha.Value.Y);
                }
                else
                {
                    transparency = new Blending();
                }
            }

            var data = new Combat.ExplodData();

            data.CommonAnimation = EvaluationHelper.IsCommon(AnimationNumber, false);
            data.AnimationNumber = animationnumber.Value;
            data.Id             = id;
            data.RemoveTime     = removetime;
            data.Location       = (Vector2)location;
            data.PositionType   = PositionType;
            data.Velocity       = velocity;
            data.Acceleration   = acceleration;
            data.Flip           = flip;
            data.BindTime       = bindtime;
            data.Random         = randomdisplacement;
            data.SuperMove      = supermove;
            data.SuperMoveTime  = supermovetime;
            data.PauseTime      = pausetime;
            data.Scale          = scale;
            data.SpritePriority = spritepriority;
            data.DrawOnTop      = ontop;
            data.OwnPalFx       = ownpalette;
            data.RemoveOnGetHit = removeongethit;
            data.IgnoreHitPause = ignorehitpause;
            data.Transparency   = transparency;

            return(data);
        }