Esempio n. 1
0
 public RangedAttack(AttackSource source, int attackRange,
                     Size projectileSize, int projectileSpeed)
     : base(source, attackRange)
 {
     this.projectileSize  = projectileSize;
     this.projectileSpeed = projectileSpeed;
 }
Esempio n. 2
0
    public static TerrorismDataPoint LoadFromSource(string rawLine)
    {
        List <string> splitLine        = RegexParser.SplitCSV(rawLine);
        string        latString        = splitLine[13];
        string        longString       = splitLine[14];
        string        yearString       = splitLine[1];
        string        monthString      = splitLine[2];
        string        dayString        = splitLine[3];
        string        deathsString     = splitLine[98];
        string        logisticalString = splitLine[133];

        AttackSource attackSource = GetAttackSourceFromString(logisticalString);

        int year  = Convert.ToInt32(yearString);
        int month = Convert.ToInt32(monthString);

        if (month == 0)
        {
            month = 1;
        }
        int day = Convert.ToInt32(dayString);

        if (day == 0)
        {
            day = 1;
        }
        DateTime time = new DateTime(year, month, day);

        return(new TerrorismDataPoint(latString, longString, deathsString, attackSource, time));
    }
Esempio n. 3
0
        public FlyAttack(Actor self, AttackSource source, Target target, bool forceAttack, Color?targetLineColor)
        {
            this.source          = source;
            this.target          = target;
            this.forceAttack     = forceAttack;
            this.targetLineColor = targetLineColor;

            aircraft       = self.Trait <Aircraft>();
            attackAircraft = self.Trait <AttackAircraft>();
            rearmable      = self.TraitOrDefault <Rearmable>();

            strafeDistance = attackAircraft.Info.StrafeRunLength;

            // The target may become hidden between the initial order request and the first tick (e.g. if queued)
            // Moving to any position (even if quite stale) is still better than immediately giving up
            if ((target.Type == TargetType.Actor && target.Actor.CanBeViewedByPlayer(self.Owner)) ||
                target.Type == TargetType.FrozenActor || target.Type == TargetType.Terrain)
            {
                lastVisibleTarget       = Target.FromPos(target.CenterPosition);
                lastVisibleMaximumRange = attackAircraft.GetMaximumRangeVersusTarget(target);

                if (target.Type == TargetType.Actor)
                {
                    lastVisibleOwner       = target.Actor.Owner;
                    lastVisibleTargetTypes = target.Actor.GetEnabledTargetTypes();
                }
                else if (target.Type == TargetType.FrozenActor)
                {
                    lastVisibleOwner       = target.FrozenActor.Owner;
                    lastVisibleTargetTypes = target.FrozenActor.TargetTypes;
                }
            }
        }
Esempio n. 4
0
 public EquippableTickInfo(
     bool inputPrimaryOn,
     bool inputPrimaryWasOn,
     bool inputSecondaryOn,
     bool inputSecondaryWasOn,
     AttackSource atkSource)
 {
     primaryOn      = inputPrimaryOn;
     primaryWasOn   = inputPrimaryWasOn;
     secondaryOn    = inputSecondaryOn;
     secondaryWasOn = inputSecondaryWasOn;
     src            = atkSource;
 }
 private Projectile(AttackSource source, int distance, Location location,
                    Size size, string sourceName, Environment map, Movement movement, IAnimation animation)
 {
     this.Movement    = movement;
     this.source      = source;
     this.distance    = distance;
     this.Location    = location;
     this.startingLoc = location;
     this.Size        = size;
     this.Name        = "Projectile of " + sourceName;
     this.map         = map;
     this.Animation   = animation;
 }
Esempio n. 6
0
    public static TerrorismDataPoint FromXml(XmlElement node)
    {
        string       latString          = node.SelectSingleNode(XmlLatNodeName).InnerText;
        string       longString         = node.SelectSingleNode(XmlLongNodeName).InnerText;
        string       deathsString       = node.SelectSingleNode(XmlDeathsNodeName).InnerText;
        string       domesticString     = node.SelectSingleNode(XmlDeathsNodeName).InnerText;
        string       timeTicks          = node.SelectSingleNode(XmlDateNodeName).InnerText;
        string       attackSourceString = node.SelectSingleNode(XmlAttackSourceNodeName).InnerText;
        long         ticks        = Convert.ToInt64(timeTicks);
        DateTime     time         = new DateTime(ticks);
        AttackSource attackSource = (AttackSource)Convert.ToInt32(attackSourceString);

        return(new TerrorismDataPoint(latString, longString, deathsString, attackSource, time));
    }
Esempio n. 7
0
    private static float ToAttackSourceWeight(AttackSource attackSource)
    {
        switch (attackSource)
        {
        case AttackSource.International:
            return(1);

        case AttackSource.Domestic:
            return(0);

        case AttackSource.Unknown:
        default:
            return(.5f);
        }
    }
Esempio n. 8
0
 public TerrorismDataPoint(string latString, string longString, string deathsString, AttackSource attackSource, DateTime time)
 {
     if (latString == "" || longString == "")
     {
         return;
     }
     Lat          = Convert.ToSingle(latString);
     Long         = Convert.ToSingle(longString);
     AttackSource = attackSource;
     if (deathsString != "")
     {
         Deaths = Convert.ToInt32(deathsString);
     }
     Time = time;
 }
Esempio n. 9
0
        public void AttackTarget(Target target, AttackSource source, bool queued, bool allowMove, bool forceAttack = false, Color?targetLineColor = null)
        {
            if (IsTraitDisabled)
            {
                return;
            }

            if (!target.IsValidFor(self))
            {
                return;
            }

            var activity = GetAttackActivity(self, source, target, allowMove, forceAttack, targetLineColor);

            self.QueueActivity(queued, activity);
            OnResolveAttackOrder(self, activity, target, queued, forceAttack);
        }
Esempio n. 10
0
 public Projectile(AttackSource source, int distance, Location location,
                   Size size, string sourceName, Environment map, int speed, Location vector, IAnimation animation)
     : this(source, distance, location, size, sourceName, map, new StrightMovement(speed, vector), animation)
 {
     if (vector.x < 0)
     {
         dirs.Add(Direction.up);
     }
     else if (vector.x > 0)
     {
         dirs.Add(Direction.down);
     }
     if (vector.y < 0)
     {
         dirs.Add(Direction.right);
     }
     else if (vector.y > 0)
     {
         dirs.Add(Direction.left);
     }
 }
Esempio n. 11
0
                // Applies damage added with nature of source.
                public void Apply(AttackSource source, float effectiveness)
                {
                    Damage damage = new Damage(source.Nature, Min, Max) { Type = Type };

                    damage.Mul(effectiveness);

                    source.Deals.Add(damage);
                }
Esempio n. 12
0
 public FlyAttack(Actor self, AttackSource source, in Target target, bool forceAttack, Color?targetLineColor)
Esempio n. 13
0
 public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color?targetLineColor)
 {
     return(new AttackTDGunboatTurretedActivity(self, newTarget, allowMove, forceAttack, targetLineColor));
 }
Esempio n. 14
0
 public abstract Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color?targetLineColor = null);
Esempio n. 15
0
    public override void _PhysicsProcess(float delta)
    {
        if (Main.i.gameInputActive)
        {
            _input.ReadGodotInputs();
        }
        else
        {
            _input.Clear();
        }

        _fpsCtrl.ProcessMovement(_input, delta);
        //Main.i.SetDebugText(_fpsCtrl.debugStr);

        if (_input.isBitOn(FPSInput.BitNextSlot))
        {
            _inventory.SelectNextWeapon();
        }
        if (_input.isBitOn(FPSInput.BitPrevSlot))
        {
            _inventory.SelectPrevWeapon();
        }

        if (_input.isBitOn(FPSInput.BitSlot1))
        {
            _inventory.SelectWeaponByIndex(0);
        }
        if (_input.isBitOn(FPSInput.BitSlot2))
        {
            _inventory.SelectWeaponByIndex(1);
        }
        if (_input.isBitOn(FPSInput.BitSlot3))
        {
            _inventory.SelectWeaponByIndex(2);
        }
        if (_input.isBitOn(FPSInput.BitSlot4))
        {
            _inventory.SelectWeaponByIndex(3);
        }
        if (_input.isBitOn(FPSInput.BitSlot5))
        {
            _inventory.SelectWeaponByIndex(4);
        }
        if (_input.isBitOn(FPSInput.BitSlot6))
        {
            _inventory.SelectWeaponByIndex(5);
        }
        if (_input.isBitOn(FPSInput.BitSlot7))
        {
            _inventory.SelectWeaponByIndex(6);
        }
        if (_input.isBitOn(FPSInput.BitSlot8))
        {
            _inventory.SelectWeaponByIndex(7);
        }

        AttackSource src = new AttackSource();

        src.team       = GetTeam();
        src.ignoreBody = _body;
        src.actorId    = _entId;

        bool secondaryOnToggled = _input.hasBitToggledOn(FPSInput.BitAttack2);

        EquippableTickInfo info = new EquippableTickInfo(
            _input.isBitOn(FPSInput.BitAttack1),
            _input.hasBitToggledOn(FPSInput.BitAttack1),
            _input.isBitOn(FPSInput.BitAttack2),
            _input.hasBitToggledOn(FPSInput.BitAttack2),
            src);

        _inventory.Tick(delta, info);

        _inventory.FillHudStatus(_hudState);
        _hudState.health = _health;
        if (_viewModel != null)
        {
            _viewModel.SetViewModelState(_hudState.view);
        }
        Main.i.ui.SetHudState(_hudState);
    }
Esempio n. 16
0
 public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color?targetLineColor)
 {
     throw new NotImplementedException("AttackBomber requires a scripted target");
 }
Esempio n. 17
0
 public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color?targetLineColor)
Esempio n. 18
0
 public void Fire(AttackSource src)
 {
     Console.WriteLine($"Melee weapon fire");
     _source = src;
     On();
 }
Esempio n. 19
0
 public Attack(AttackSource source, int attackRange)
 {
     this.source      = source;
     this.attackRange = attackRange;
 }
Esempio n. 20
0
 public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color?targetLineColor)
 {
     return(new InfectRV(self, newTarget, this, info, targetLineColor));
 }
Esempio n. 21
0
 public Projectile(AttackSource source, int distance, Location location,
                   Size size, string sourceName, Environment map, int speed, Direction direction, IAnimation animation)
     : this(source, distance, location, size, sourceName, map, new StrightMovement(speed, direction), animation)
 {
     dirs.Add(direction);
 }
Esempio n. 22
0
 public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color?targetLineColor = null)
 {
     return(new FlyAttack(self, source, newTarget, forceAttack, targetLineColor));
 }
Esempio n. 23
0
 protected AttackUnit(int experience, int health, int armor, int initiative, int chanceToHit, Target targetType, AttackSource attackSource, int damage)
     : base(experience, health, armor, initiative, chanceToHit, targetType, attackSource)
 {
     this.Damage = damage;
 }
Esempio n. 24
0
 public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color?targetLineColor)
 {
     return(new SwallowTarget(self, newTarget, allowMove, forceAttack));
 }
Esempio n. 25
0
 public override void FirePrimary(AttackSource src)
 {
     base.FirePrimary(src);
 }
 protected Unit(int experience, int health, int armor, int initiative, int chanceToHit, Target targetType, AttackSource attackSource)
 {
     this.Experience   = experience;
     this.Health       = health;
     this.Armor        = armor;
     this.Initiative   = initiative;
     this.ChanceToHit  = chanceToHit;
     this.TargetType   = targetType;
     this.AttackSource = attackSource;
     this.IsAlive      = true;
 }
Esempio n. 27
0
 public MeleeAttack(AttackSource source, int attackRange) : base(source, attackRange)
 {
 }