Exemplo n.º 1
0
        public override void Run(Combat.Character character)
        {
            Int32?  statenumber     = EvaluationHelper.AsInt32(character, StateNumber, null);
            Boolean?playercontrol   = EvaluationHelper.AsBoolean(character, Control, null);
            Int32?  animationnumber = EvaluationHelper.AsInt32(character, AnimationNumber, null);

            if (statenumber == null)
            {
                return;
            }
            character.StateManager.ChangeState(statenumber.Value);

            if (playercontrol != null)
            {
                if (playercontrol == true)
                {
                    character.PlayerControl = PlayerControl.InControl;
                }
                if (playercontrol == false)
                {
                    character.PlayerControl = PlayerControl.NoControl;
                }
            }

            if (animationnumber != null)
            {
                character.SetLocalAnimation(animationnumber.Value, 0);
            }
        }
Exemplo n.º 2
0
        public override void Run(Combat.Character character)
        {
            Int32   animationnumber    = EvaluationHelper.AsInt32(character, AnimationNumber, 0);
            Boolean drawunder          = EvaluationHelper.AsBoolean(character, DrawUnder, false);
            Point   offset             = EvaluationHelper.AsPoint(character, DrawPosition, new Point(0, 0));
            Int32   randomdisplacement = EvaluationHelper.AsInt32(character, RandomDisplacement, 0);

            Combat.ExplodData data = new xnaMugen.Combat.ExplodData();
            data.Scale           = Vector2.One;
            data.AnimationNumber = animationnumber;
            data.CommonAnimation = true;
            data.Location        = (Vector2)offset;
            data.PositionType    = PositionType.P1;
            data.RemoveTime      = -2;
            data.DrawOnTop       = false;
            data.OwnPalFx        = true;
            data.SpritePriority  = (drawunder == true) ? -9 : 9;
            data.Random          = new Point(randomdisplacement / 2, randomdisplacement / 2);
            data.Transparency    = new Blending();
            data.Creator         = character;
            data.Offseter        = character;

            Combat.Explod explod = new Combat.Explod(character.Engine, data);
            if (explod.IsValid == true)
            {
                explod.Engine.Entities.Add(explod);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        public override void Run(Combat.Character character)
        {
            var amount   = EvaluationHelper.AsInt32(character, Amount, null);
            var targetId = EvaluationHelper.AsInt32(character, TargetId, int.MinValue);
            var cankill  = EvaluationHelper.AsBoolean(character, CanKill, true);
            var absolute = EvaluationHelper.AsBoolean(character, Absolute, false);

            if (amount == null)
            {
                return;
            }

            foreach (var target in character.GetTargets(targetId))
            {
                var newamount = amount.Value;

                if (absolute == false && newamount < 0)
                {
                    newamount = (int)(newamount * character.OffensiveInfo.AttackMultiplier);
                    newamount = (int)(newamount / target.DefensiveInfo.DefenseMultiplier);
                }

                target.Life += newamount;
                if (target.Life == 0 && cankill == false)
                {
                    target.Life = 1;
                }
            }
        }
Exemplo n.º 5
0
        public override void Run(Combat.Character character)
        {
            Int32?  amount   = EvaluationHelper.AsInt32(character, Amount, null);
            Boolean cankill  = EvaluationHelper.AsBoolean(character, CanKill, true);
            Boolean absolute = EvaluationHelper.AsBoolean(character, Absolute, false);

            if (amount == null)
            {
                return;
            }

            Int32 scaledamount = amount.Value;

            if (absolute == false)
            {
                scaledamount = (Int32)(scaledamount / character.DefensiveInfo.DefenseMultiplier);
            }

            character.Life += scaledamount;

            if (cankill == false && character.Life == 0)
            {
                character.Life = 1;
            }
        }
Exemplo n.º 6
0
        public override void Run(Combat.Character character)
        {
            var color     = EvaluationHelper.AsVector3(character, ScreenColor, Vector3.One);
            var time      = EvaluationHelper.AsInt32(character, Time, 1);
            var underflag = EvaluationHelper.AsBoolean(character, Under, false);

            character.Engine.EnvironmentColor.Setup(color, time, underflag);
        }
Exemplo n.º 7
0
        public override void Run(Combat.Character character)
        {
            var pushflag = EvaluationHelper.AsBoolean(character, PushFlag, null);

            if (pushflag != null)
            {
                character.PushFlag = pushflag.Value;
            }
        }
Exemplo n.º 8
0
        public override void Run(Combat.Character character)
        {
            var boundflag  = EvaluationHelper.AsBoolean(character, BoundFlag, false);
            var movecamera = EvaluationHelper.AsPoint(character, MoveCamera, new Point(0, 0));

            character.ScreenBound   = boundflag;
            character.CameraFollowX = movecamera.X > 0;
            character.CameraFollowY = movecamera.Y > 0;
        }
Exemplo n.º 9
0
        public override void Run(Combat.Character character)
        {
            Int32   time      = EvaluationHelper.AsInt32(character, Time, -2);
            Vector3 paladd    = EvaluationHelper.AsVector3(character, PaletteColorAdd, new Vector3(0, 0, 0));
            Vector3 palmul    = EvaluationHelper.AsVector3(character, PaletteColorMultiply, new Vector3(255, 255, 255));
            Vector4 sinadd    = EvaluationHelper.AsVector4(character, PaletteColorSineAdd, new Vector4(0, 0, 0, 1));
            Boolean invert    = EvaluationHelper.AsBoolean(character, PaletteColorInversion, false);
            Int32   basecolor = EvaluationHelper.AsInt32(character, PaletteColor, 255);

            character.PaletteFx.Set(time, paladd, palmul, sinadd, invert, basecolor / 255.0f);
        }
Exemplo n.º 10
0
        public override void Run(Combat.Character character)
        {
            var helperName        = Name ?? character.BasePlayer.Profile.DisplayName + "'s Helper";
            var helperId          = EvaluationHelper.AsInt32(character, Id, 0);
            var positionOffset    = (Vector2)EvaluationHelper.AsPoint(character, Position, new Point(0, 0));
            var facingflag        = EvaluationHelper.AsInt32(character, Facing, 1);
            var statenumber       = EvaluationHelper.AsInt32(character, StateNumber, 0);
            var keycontrol        = EvaluationHelper.AsBoolean(character, KeyControl, false);
            var ownpalette        = EvaluationHelper.AsBoolean(character, OwnPalette, false);
            var supermovetime     = EvaluationHelper.AsInt32(character, SuperMoveTime, 0);
            var pausemovetime     = EvaluationHelper.AsInt32(character, PauseMoveTime, 0);
            var scalex            = EvaluationHelper.AsSingle(character, XScale, character.BasePlayer.Constants.Scale.X);
            var scaley            = EvaluationHelper.AsSingle(character, YScale, character.BasePlayer.Constants.Scale.Y);
            var groundfront       = EvaluationHelper.AsInt32(character, GroundFrontSize, character.BasePlayer.Constants.GroundFront);
            var groundback        = EvaluationHelper.AsInt32(character, GroundBackSize, character.BasePlayer.Constants.GroundBack);
            var airfront          = EvaluationHelper.AsInt32(character, AirFrontSize, character.BasePlayer.Constants.Airfront);
            var airback           = EvaluationHelper.AsInt32(character, AirBackSize, character.BasePlayer.Constants.Airback);
            var height            = EvaluationHelper.AsInt32(character, Height, character.BasePlayer.Constants.Height);
            var projectilescaling = EvaluationHelper.AsBoolean(character, ProjectileScaling, character.BasePlayer.Constants.ProjectileScaling);
            var headposition      = (Vector2)EvaluationHelper.AsPoint(character, HeadPosition, (Point)character.BasePlayer.Constants.Headposition);
            var midposition       = (Vector2)EvaluationHelper.AsPoint(character, MiddlePosition, (Point)character.BasePlayer.Constants.Midposition);
            var shadowoffset      = EvaluationHelper.AsInt32(character, ShadowOffset, character.BasePlayer.Constants.Shadowoffset);

            var data = new Combat.HelperData();

            data.Name               = helperName;
            data.HelperId           = helperId;
            data.Type               = HelperType;
            data.FacingFlag         = facingflag;
            data.PositionType       = PositionType;
            data.CreationOffset     = positionOffset;
            data.KeyControl         = keycontrol;
            data.OwnPaletteFx       = ownpalette;
            data.InitialStateNumber = statenumber;
            data.Scale              = new Vector2(scalex, scaley);
            data.GroundFront        = groundfront;
            data.GroundBack         = groundback;
            data.AirFront           = airfront;
            data.AirBack            = airback;
            data.Height             = height;
            data.SuperPauseTime     = supermovetime;
            data.PauseTime          = pausemovetime;
            data.ProjectileScaling  = projectilescaling;
            data.HeadPosition       = headposition;
            data.MidPosition        = midposition;
            data.ShadowOffset       = shadowoffset;

            var helper = new Combat.Helper(character.Engine, character, data);

            helper.Engine.Entities.Add(helper);
        }
Exemplo n.º 11
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);
            }
        }
Exemplo n.º 12
0
        public override void Run(Combat.Character character)
        {
            var slotnumber  = EvaluationHelper.AsInt32(character, SlotNumber, 0);
            var statenumber = EvaluationHelper.AsInt32(character, StateNumber, int.MinValue);
            var time        = EvaluationHelper.AsInt32(character, Time, 1);
            var forceair    = EvaluationHelper.AsBoolean(character, ForceAir, false);

            if (slotnumber < 0 || slotnumber > 7)
            {
                return;
            }

            character.DefensiveInfo.HitOverrides[slotnumber].Set(Override, statenumber, time, forceair);
        }
Exemplo n.º 13
0
        public override void Run(Combat.Character character)
        {
            var time       = EvaluationHelper.AsInt32(character, Time, null);
            var buffertime = EvaluationHelper.AsInt32(character, EndCommandBufferTime, 0);
            var movetime   = EvaluationHelper.AsInt32(character, MoveTime, 0);
            var pausebg    = EvaluationHelper.AsBoolean(character, PauseBackgrounds, true);

            if (time == null)
            {
                return;
            }

            character.Engine.Pause.Set(character, time.Value, buffertime, movetime, false, pausebg);
        }
Exemplo n.º 14
0
        public override void Run(Combat.Character character)
        {
            var control = EvaluationHelper.AsBoolean(character, Control, null);

            if (control != null)
            {
                if (control == true)
                {
                    character.PlayerControl = PlayerControl.InControl;
                }
                if (control == false)
                {
                    character.PlayerControl = PlayerControl.NoControl;
                }
            }
        }
Exemplo n.º 15
0
        public override void Run(Combat.Character character)
        {
            var time      = EvaluationHelper.AsInt32(character, Time, -2);
            var paladd    = EvaluationHelper.AsVector3(character, PaletteColorAdd, new Vector3(0, 0, 0));
            var palmul    = EvaluationHelper.AsVector3(character, PaletteColorMultiply, new Vector3(255, 255, 255));
            var sinadd    = EvaluationHelper.AsVector4(character, PaletteColorSineAdd, new Vector4(0, 0, 0, 1));
            var invert    = EvaluationHelper.AsBoolean(character, PaletteColorInversion, false);
            var basecolor = EvaluationHelper.AsInt32(character, PaletteColor, 255);

            foreach (var entity in character.Engine.Entities)
            {
                entity.PaletteFx.Set(time, paladd, palmul, sinadd, invert, basecolor);
            }

            character.Engine.Stage.PaletteFx.Set(time, paladd, palmul, sinadd, invert, basecolor);
        }
Exemplo n.º 16
0
        public override void Run(Combat.Character character)
        {
            Int32   exclude_id = EvaluationHelper.AsInt32(character, Id, -1);
            Boolean keepone    = EvaluationHelper.AsBoolean(character, KeepOne, true);


            List <Combat.Character> removelist = new List <Combat.Character>();

            foreach (Combat.Character target in character.GetTargets(Int32.MinValue))
            {
                if (exclude_id != -1 && target.DefensiveInfo.HitDef.TargetId == exclude_id)
                {
                    continue;
                }

                removelist.Add(target);
            }

            if (removelist.Count > 0 && keepone == true)
            {
                removelist.RemoveAt(0);
            }

            foreach (Combat.Character target in removelist)
            {
                character.OffensiveInfo.TargetList.Remove(target);
            }

            /*
             * Boolean keptone = false;
             * foreach (Combat.Entity entity in character.Engine.Entities)
             * {
             *      Combat.Character target = character.FilterEntityAsTarget(entity, Int32.MinValue);
             *      if (target == null) continue;
             *
             *      if (exclude_id != -1 && target.DefensiveInfo.HitDef.TargetId == exclude_id) continue;
             *
             *      if (keptone == false)
             *      {
             *              keptone = true;
             *              continue;
             *      }
             *
             *      character.OffensiveInfo.TargetList.Remove(target);
             * }
             */
        }
Exemplo n.º 17
0
        public Boolean Check(Combat.Character character)
        {
            if (character == null)
            {
                throw new ArgumentNullException("character");
            }

            foreach (Evaluation.Expression trigger in m_expressions)
            {
                if (EvaluationHelper.AsBoolean(character, trigger, false) == false)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 18
0
        public override void Run(Combat.Character character)
        {
            var time      = EvaluationHelper.AsInt32(character, Time, -2);
            var paladd    = EvaluationHelper.AsVector3(character, PaletteColorAdd, new Vector3(0, 0, 0));
            var palmul    = EvaluationHelper.AsVector3(character, PaletteColorMultiply, new Vector3(255, 255, 255));
            var sinadd    = EvaluationHelper.AsVector4(character, PaletteColorSineAdd, new Vector4(0, 0, 0, 1));
            var invert    = EvaluationHelper.AsBoolean(character, PaletteColorInversion, false);
            var basecolor = EvaluationHelper.AsInt32(character, PaletteColor, 255);

            if (time < -1)
            {
                return;
            }

            var palfx = character.Engine.Stage.PaletteFx;

            palfx.Set(time, paladd, palmul, sinadd, invert, basecolor / 255.0f);
        }
Exemplo n.º 19
0
        public override void Run(Combat.Character character)
        {
            var time           = EvaluationHelper.AsInt32(character, Time, 1);
            var numberofframes = EvaluationHelper.AsInt32(character, NumberOfFrames, 20);
            var basecolor      = EvaluationHelper.AsInt32(character, PaletteColor, 255);
            var invert         = EvaluationHelper.AsBoolean(character, PaletteColorInversion, false);
            var palpreadd      = EvaluationHelper.AsVector3(character, PaletteColorBrightness, new Vector3(30, 30, 30));
            var palcontrast    = EvaluationHelper.AsVector3(character, PaletteColorContrast, new Vector3(255, 255, 255));
            var palpostadd     = EvaluationHelper.AsVector3(character, PalettePostBrightness, new Vector3(0, 0, 0));
            var paladd         = EvaluationHelper.AsVector3(character, PaletteColorAdd, new Vector3(10, 10, 25));
            var palmul         = EvaluationHelper.AsVector3(character, PaletteColorMultiply, new Vector3(.65f, .65f, .75f));
            var timegap        = EvaluationHelper.AsInt32(character, TimeGap, 1);
            var framegap       = EvaluationHelper.AsInt32(character, FrameGap, 4);
            var alpha          = EvaluationHelper.AsPoint(character, Alpha, new Point(255, 0));

            var trans = Transparency;

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

            var afterimages = character.AfterImages;

            afterimages.Reset();
            afterimages.DisplayTime          = time;
            afterimages.NumberOfFrames       = numberofframes;
            afterimages.BaseColor            = basecolor / 255.0f;
            afterimages.InvertColor          = invert;
            afterimages.ColorPreAdd          = Vector3.Clamp(palpreadd / 255.0f, Vector3.Zero, Vector3.One);
            afterimages.ColorContrast        = Vector3.Clamp(palcontrast / 255.0f, Vector3.Zero, new Vector3(float.MaxValue));
            afterimages.ColorPostAdd         = Vector3.Clamp(palpostadd / 255.0f, Vector3.Zero, Vector3.One);
            afterimages.ColorPaletteAdd      = Vector3.Clamp(paladd / 255.0f, Vector3.Zero, Vector3.One);
            afterimages.ColorPaletteMultiply = Vector3.Clamp(palmul, Vector3.Zero, new Vector3(float.MaxValue));
            afterimages.TimeGap      = timegap;
            afterimages.FrameGap     = framegap;
            afterimages.Transparency = trans;
            afterimages.IsActive     = true;
        }
Exemplo n.º 20
0
        public override void Run(Combat.Character character)
        {
            Boolean velx = EvaluationHelper.AsBoolean(character, XVelocity, true);
            Boolean vely = EvaluationHelper.AsBoolean(character, YVelocity, true);

            Vector2 vel = character.DefensiveInfo.GetHitVelocity();

            if (character.DefensiveInfo.Attacker.CurrentFacing == character.CurrentFacing)
            {
                vel *= new Vector2(-1, 1);
            }

            if (velx == false)
            {
                vel.X = character.CurrentVelocity.X;
            }
            if (vely == false)
            {
                vel.Y = character.CurrentVelocity.Y;
            }

            character.CurrentVelocity = vel;
        }
Exemplo n.º 21
0
        public override void Run(Combat.Character character)
        {
            var freeze = EvaluationHelper.AsBoolean(character, Freeze, true);

            character.PositionFreeze = freeze;
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
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);
        }
Exemplo n.º 24
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);
        }
Exemplo n.º 25
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);
        }
Exemplo n.º 26
0
        void ApplyState(State state)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state");
            }

            m_persistencemap.Clear();

            if (state.Physics != Physics.Unchanged)
            {
                Character.Physics = state.Physics;
            }
            if (state.StateType != StateType.Unchanged)
            {
                Character.StateType = state.StateType;
            }
            if (state.MoveType != MoveType.Unchanged)
            {
                Character.MoveType = state.MoveType;
            }

            Int32?playercontrol = EvaluationHelper.AsInt32(m_character, state.PlayerControl, null);

            if (playercontrol != null)
            {
                Character.PlayerControl = (playercontrol > 0) ? PlayerControl.InControl : PlayerControl.NoControl;
            }

            Int32?animationnumber = EvaluationHelper.AsInt32(m_character, state.AnimationNumber, null);

            if (animationnumber != null)
            {
                Character.SetLocalAnimation(animationnumber.Value, 0);
            }

            Int32?spritepriority = EvaluationHelper.AsInt32(m_character, state.SpritePriority, null);

            if (spritepriority != null)
            {
                Character.DrawOrder = spritepriority.Value;
            }

            Int32?power = EvaluationHelper.AsInt32(m_character, state.Power, null);

            if (power != null)
            {
                Character.BasePlayer.Power += power.Value;
            }

            Vector2?velocity = EvaluationHelper.AsVector2(m_character, state.Velocity, null);

            if (velocity != null)
            {
                Character.CurrentVelocity = velocity.Value;
            }

            Boolean hitdefpersistance = EvaluationHelper.AsBoolean(m_character, state.HitdefPersistance, false);

            if (hitdefpersistance == false)
            {
                Character.OffensiveInfo.ActiveHitDef = false;
                Character.OffensiveInfo.HitPauseTime = 0;
            }

            Boolean movehitpersistance = EvaluationHelper.AsBoolean(m_character, state.MovehitPersistance, false);

            if (movehitpersistance == false)
            {
                Character.OffensiveInfo.MoveReversed = 0;
                Character.OffensiveInfo.MoveHit      = 0;
                Character.OffensiveInfo.MoveGuarded  = 0;
                Character.OffensiveInfo.MoveContact  = 0;
            }

            Boolean hitcountpersistance = EvaluationHelper.AsBoolean(m_character, state.HitCountPersistance, false);

            if (hitcountpersistance == false)
            {
                Character.OffensiveInfo.HitCount       = 0;
                Character.OffensiveInfo.UniqueHitCount = 0;
            }
        }