コード例 #1
0
        public TacChar(TacticalActor context)
            : this()
        {
            switch (context.SerializationData.MissionParticipant.EnumName)
            {
            case "Player":
                border.BorderBrush     = System.Windows.Media.Brushes.Green;
                border.BorderThickness = new Thickness(2);
                break;

            case "Intruder":
                border.BorderBrush     = System.Windows.Media.Brushes.Red;
                border.BorderThickness = new Thickness(2);
                break;

            default:
                break;
            }
            //val.SerializationData.OverrideName.LocalizationKey, val.SerializationData.Stats
            if (context.SerializationData.OverrideName != null)
            {
                _tacCharName = context.SerializationData.OverrideName.LocalizationKey;
            }
            else
            {
                _tacCharName = context.ActorCreateData.Name;
            }
            _context = context;
        }
コード例 #2
0
 public static void Pre_FireWeaponAtTargetCrt(Weapon weapon, TacticalAbilityTarget abilityTarget)
 {
     if (abilityTarget.AttackType == AttackType.ReturnFire)
     {
         TacticalActor tacticalActor = weapon.TacticalActor;
         returnFireCounter.TryGetValue(tacticalActor, out var currentCount);
         returnFireCounter[tacticalActor] = currentCount + 1;
     }
 }
コード例 #3
0
 void TestEquip(TacticalActor actor, TacticalItem item)
 {
     TestEquip2H(actor, item);
     TestUnequip(actor, EquipSlot.Slot.arm_l);
     TestEquip2H(actor, item);
     TestUnequip(actor, EquipSlot.Slot.arm_r);
     TestEquip2H(actor, item);
     TestUnequip(actor, EquipSlot.Slot.arm_2h);
 }
コード例 #4
0
        private static bool isAngleOK(TacticalActor shooter, TacticalActorBase target, float reactionAngleCos)
        {
            if (reactionAngleCos > 0.99)
            {
                return(true);
            }
            Vector3 targetForward   = target.transform.TransformDirection(Vector3.forward);
            Vector3 targetToShooter = (shooter.Pos - target.Pos).normalized;
            float   angleCos        = Vector3.Dot(targetForward, targetToShooter);

            return(Utl.GreaterThanOrEqualTo(angleCos, reactionAngleCos));
        }
コード例 #5
0
    void TestUnequip(TacticalActor actor, EquipSlot.Slot slot)
    {
        ActUnequip action = (ActUnequip)actor.actions["Unequip Item"];

        action.Act(slot);
        var q = actor.QueryAnatomy();

        Assert.IsTrue(q[EquipSlot.Slot.arm_2h] == "None");
        Assert.IsTrue(q[EquipSlot.Slot.arm_l] == "None");
        Assert.IsTrue(q[EquipSlot.Slot.arm_r] == "None");
        Debug.Log("Test Unequip 2H completed");
    }
コード例 #6
0
    void TestEquip2H(TacticalActor actor, TacticalItem item)
    {
        ActEquip action = (ActEquip)actor.actions["Equip Item"];

        action.Act(item);
        var q = actor.QueryAnatomy();

        Assert.IsTrue(q[EquipSlot.Slot.arm_2h] == item.name);
        Assert.IsTrue(q[EquipSlot.Slot.arm_l] == item.name);
        Assert.IsTrue(q[EquipSlot.Slot.arm_r] == item.name);
        Debug.Log("Test Equip 2H completed");
    }
コード例 #7
0
    // Use this for initialization
    void Start()
    {
        tactical_actor_prefab     = Resources.Load <TacticalActor>("ActorPrefab");
        tactical_equipment_prefab = Resources.Load <TacticalItem>("ItemPrefab");

        TacticalActor actor_0 = Instantiate(tactical_actor_prefab);
        TacticalItem  item_2h = Instantiate(tactical_equipment_prefab);

        actor_0.Spawn();
        item_2h.Spawn("Gaebolg Spear", EquipSlot.Slot.arm_2h);
        TestEquip(actor_0, item_2h);
    }
コード例 #8
0
 public void EngageMeleeAgainst(TacticalActor other_actor, TacticalAction action)
 {
 }
コード例 #9
0
        public static bool Pre_GetReturnFireAbilities(
            TacticalLevelController __instance,
            ref List <ReturnFireAbility> __result,
            TacticalActor shooter,
            Weapon weapon,
            TacticalAbilityTarget target,
            ShootAbility shootAbility,
            bool getOnlyPossibleTargets     = false,
            List <TacticalActor> casualties = null)
        {
            // No return fire for the following attacks
            WeaponDef weaponDef = weapon?.WeaponDef;

            if (target.AttackType == AttackType.ReturnFire ||
                target.AttackType == AttackType.Overwatch ||
                target.AttackType == AttackType.Synced ||
                target.AttackType == AttackType.ZoneControl ||
                weaponDef != null && weaponDef.NoReturnFireFromTargets)
            {
                __result = null;
                return(false);
            }

            List <ReturnFireAbility>    list;
            IEnumerable <TacticalActor> actors = __instance.Map.GetActors <TacticalActor>(null);

            using (MultiForceDummyTargetableLock multiForceDummyTargetableLock = new MultiForceDummyTargetableLock(actors))
            {
                list = actors
                       // Get alive enemies for the shooter
                       .Where((TacticalActor actor) => {
                    return(actor.IsAlive && actor.RelationTo(shooter) == FactionRelation.Enemy);
                })
                       // Select the ones that have the return fire ability, ordered by priority
                       // Rmq: it is possible to have an actor twice if he has multiple RF abilities
                       .SelectMany((TacticalActor actor) =>
                                   from a in actor.GetAbilities <ReturnFireAbility>()
                                   orderby a.ReturnFireDef.ReturnFirePriority
                                   select a, (TacticalActor actor, ReturnFireAbility ability) =>
                                   new { actor = actor, ability = ability }
                                   )
                       // Check if shooter is a valid target for each actor/ability
                       .Where((actorAbilities) =>
                              actorAbilities.ability.IsEnabled(IgnoredAbilityDisabledStatesFilter.IgnoreNoValidTargetsFilter) &&
                              actorAbilities.ability.IsValidTarget(shooter)
                              )
                       // Group by actor and keep only first valid ability
                       .GroupBy((actorAbilities) => actorAbilities.actor, (actorAbilities) => actorAbilities.ability)
                       .Select((IGrouping <TacticalActor, ReturnFireAbility> actorAbilities) =>
                               new { actorReturns = actorAbilities, actorAbility = actorAbilities.First() }
                               )
                       // Make sure the target of the attack is the first one to retaliate
                       .OrderByDescending((actorAbilities) => actorAbilities.actorAbility.TacticalActor == target.GetTargetActor())
                       .Select((actorAbilities) => actorAbilities.actorAbility)
                       .Where((ReturnFireAbility returnFireAbility) => {
                    TacticalActor tacticalActor = returnFireAbility.TacticalActor;
                    // Check that he has not retaliated too much already
                    int actorShotLimit = tacticalActor.IsMetallic ? turretsShotLimit : shotLimit;
                    if (actorShotLimit > 0)
                    {
                        returnFireCounter.TryGetValue(tacticalActor, out var currentCount);
                        if (currentCount >= actorShotLimit)
                        {
                            return(false);
                        }
                    }
                    // Always allow bash riposte
                    if (returnFireAbility.ReturnFireDef.RiposteWithBashAbility)
                    {
                        return(allowBashRiposte);
                    }
                    // Checks if the target is allowed to retaliate
                    // Rmq: Skipped when doing predictions on who will return fire (getOnlyPossibleTargets == false)
                    if (getOnlyPossibleTargets)
                    {
                        if (target.Actor == tacticalActor ||
                            target.MultiAbilityTargets != null && target.MultiAbilityTargets.Any((TacticalAbilityTarget mat) => mat.Actor == tacticalActor))
                        {
                            // The actor was one of the targets
                            if (!targetCanRetaliate)
                            {
                                return(false);
                            }
                        }
                        else if (casualties != null && casualties.Contains(tacticalActor))
                        {
                            // The actor was one of the casualties (not necessarily the target)
                            if (!casualtiesCanRetaliate)
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            if (!bystandersCanRetaliate)
                            {
                                return(false);
                            }
                        }
                    }
                    float actorReactionAngleCos = tacticalActor.IsMetallic ? turretsReactionAngleCos : reactionAngleCos;
                    if (!isAngleOK(shooter, tacticalActor, actorReactionAngleCos))
                    {
                        return(false);
                    }
                    // Check that target won't need to move to retaliate
                    ShootAbility defaultShootAbility        = returnFireAbility.GetDefaultShootAbility();
                    TacticalAbilityTarget attackActorTarget = defaultShootAbility.GetAttackActorTarget(shooter, AttackType.ReturnFire);
                    if (attackActorTarget == null || !Utl.Equals(attackActorTarget.ShootFromPos, defaultShootAbility.Actor.Pos, 1E-05f))
                    {
                        return(false);
                    }
                    TacticalActor tacticalActor1 = null;
                    // Prevent friendly fire
                    if (checkFriendlyFire && returnFireAbility.TacticalActor.TacticalPerception.CheckFriendlyFire(returnFireAbility.Weapon, attackActorTarget.ShootFromPos, attackActorTarget, out tacticalActor1, FactionRelation.Neutral | FactionRelation.Friend))
                    {
                        return(false);
                    }
                    if (!returnFireAbility.TacticalActor.TacticalPerception.HasFloorSupportAt(returnFireAbility.TacticalActor.Pos))
                    {
                        return(false);
                    }
                    // Check that we have a line of sight between both actors at a perception ratio (including stealth stuff)
                    float actorPerceptionRatio = tacticalActor.IsMetallic ? turretsPerceptionRatio : perceptionRatio;
                    if (!TacticalFactionVision.CheckVisibleLineBetweenActors(returnFireAbility.TacticalActor, returnFireAbility.TacticalActor.Pos,
                                                                             shooter, false, null, actorPerceptionRatio))
                    {
                        return(false);
                    }
                    return(true);
                }).ToList();
            }
            __result = list;
            return(false);
        }
コード例 #10
0
 public ActUnequip(TacticalActor actor) : base(actor)
 {
     base.SetName("Unequip Item");
     base.is_available = true;
 }
コード例 #11
0
 public TacticalAction(TacticalActor _actor)
 {
     is_available = false;
     actor        = _actor;
 }
コード例 #12
0
ファイル: ActWait.cs プロジェクト: gbudiman/projectviolet3
 public ActWait(TacticalActor actor) : base(actor)
 {
     base.SetName("Wait");
 }
コード例 #13
0
 public ActMove(TacticalActor actor) : base(actor)
 {
     base.SetName("Move");
     base.is_available = true;
 }