protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
        {
            ItemPrefab itemPrefab = null;

            if ((abilityObject as IAbilityItemPrefab)?.ItemPrefab is ItemPrefab abilityItemPrefab)
            {
                itemPrefab = abilityItemPrefab;
            }
            else if ((abilityObject as IAbilityItem)?.Item is Item abilityItem)
            {
                itemPrefab = abilityItem.Prefab;
            }

            if (itemPrefab != null)
            {
                if (identifiers.Any())
                {
                    if (!identifiers.Any(t => itemPrefab.Identifier == t))
                    {
                        return(false);
                    }
                }

                return(!tags.Any() || tags.Any(t => itemPrefab.Tags.Any(p => t == p)));
            }
            else
            {
                LogAbilityConditionError(abilityObject, typeof(IAbilityItemPrefab));
                return(false);
            }
        }
        protected override void ApplyEffect(AbilityObject abilityObject)
        {
            if ((abilityObject as IAbilityItem)?.Item is Item item)
            {
                if (oncePerContainer)
                {
                    if (openedContainers.Contains(item))
                    {
                        return;
                    }
                    openedContainers.Add(item);
                }
                if (randomChance < Rand.Range(0f, 1f, Rand.RandSync.Unsynced))
                {
                    return;
                }

                foreach (var statusEffect in statusEffects)
                {
                    statusEffect.Apply(ActionType.OnAbility, EffectDeltaTime, item, item);
                }
            }
            else
            {
                LogabilityObjectMismatch();
            }
        }
 protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
 {
     if (abilityObject is IAbilityLocation abilityLocation)
     {
         if (locationIdentifiers.Any())
         {
             if (!locationIdentifiers.Contains(abilityLocation.Location.Type.Identifier))
             {
                 return(false);
             }
         }
         if (hasOutpost.HasValue)
         {
             if (hasOutpost.Value != abilityLocation.Location.HasOutpost())
             {
                 return(false);
             }
         }
         return(true);
     }
     else
     {
         LogAbilityConditionError(abilityObject, typeof(IAbilityItemPrefab));
         return(false);
     }
 }
Beispiel #4
0
    public void AddAttackAnimation(CardObject card, AbilityObject ability, Color color)
    {
        CardAnimationDamage dmg = Instantiate(_prefabDamage, transform);

        dmg.SetAnimation(card, ability, color);
        _queue.Add(dmg);
    }
Beispiel #5
0
 void PlaceCardInSlot(AbilityObject card, AbilitySlot slot)
 {
     card._slot    = slot;
     slot._ability = card;
     card.transform.SetParent(slot.transform);
     card.transform.localPosition = Vector3.zero;
 }
Beispiel #6
0
 protected override void ApplyEffect(AbilityObject abilityObject)
 {
     if (abilityObject is AbilitySkillGain abilitySkillGain && !abilitySkillGain.GainedFromApprenticeship && abilitySkillGain.Character != Character)
     {
         Character.Info?.IncreaseSkillLevel(abilitySkillGain.String, 1.0f, gainedFromApprenticeship: true);
     }
 }
Beispiel #7
0
 protected override void ApplyEffect(AbilityObject abilityObject)
 {
     if ((abilityObject as AbilityAttackData)?.Attacker is Character attacker)
     {
         ApplyEffectSpecific(attacker);
     }
 }
 protected override void ApplyEffect(AbilityObject abilityObject)
 {
     if ((abilityObject as IAbilityCharacter)?.Character is Character character)
     {
         Character.GiveMoney((int)(vitalityPercentage * character.MaxVitality));
     }
 }
        protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
        {
            if ((abilityObject as IAbilityAttackResult)?.AttackResult is AttackResult attackResult)
            {
                if (!IsViableTarget(targetTypes, attackResult.HitLimb?.character))
                {
                    return(false);
                }

                if (afflictions.Any())
                {
                    if (attackResult.Afflictions == null || !afflictions.Any(a => attackResult.Afflictions.Select(c => c.Identifier).Contains(a)))
                    {
                        return(false);
                    }
                }

                return(true);
            }
            else
            {
                LogAbilityConditionError(abilityObject, typeof(IAbilityAttackResult));
                return(false);
            }
        }
Beispiel #10
0
    IEnumerator ApplyAbility()
    {
        AbilityObject ability = playerController.abilities [abilityNumber];

        image.fillAmount    = 1;
        button.interactable = false;
        if (ability.isFirerate)
        {
            float oldFirerate = playerController.weapons [playerController.currentWeapon].fireRate;
            playerController.fireRate = oldFirerate * ability.fireRate;
            yield return(new WaitForSeconds(ability.duration));

            playerController.fireRate = oldFirerate;
        }
        else if (ability.isShield)
        {
            playerController.ActivateShield();
            yield return(new WaitForSeconds(ability.duration));

            playerController.DiactivateShield();
        }
        else
        {
            int oldDamage = playerController.weapons [playerController.currentWeapon].damage;
            playerController.weapons [playerController.currentWeapon].damage = ability.damage + oldDamage;
            yield return(new WaitForSeconds(ability.duration));

            playerController.weapons [playerController.currentWeapon].damage = oldDamage;
        }
        AnimateCooldown(ability.cooldown);
    }
 protected override void ApplyEffect(AbilityObject abilityObject)
 {
     if (Character?.Info is CharacterInfo info)
     {
         Character.GiveMoney(moneyPerMission * info.MissionsCompletedSinceDeath);
     }
 }
Beispiel #12
0
    public void SetSlot(AbilityObject ability)
    {
        if (ability.AbilityType == AbilityObject.AbilityTypes.Melee)
        {
            Melee = ability;

            PlayerHandler.PH.Melee = Melee;


            assignSlot(ability, MeleeSlot);
        }
        else if (ability.AbilityType == AbilityObject.AbilityTypes.Protection)
        {
            Protection = ability;

            PlayerHandler.PH.Protection = Protection;

            assignSlot(ability, ProtectionSlot);
        }
        else if (ability.AbilityType == AbilityObject.AbilityTypes.Range)
        {
            Range = ability;

            PlayerHandler.PH.Range = Range;

            assignSlot(ability, RangeSlot);
        }
    }
 protected override void ApplyEffect(AbilityObject abilityObject)
 {
     if (abilityObject is IAbilityValue abilityValue)
     {
         abilityValue.Value += addedValue;
         abilityValue.Value *= multiplyValue;
     }
 }
 private bool IsApplicable(AbilityObject abilityObject)
 {
     if (timesTriggered >= maxTriggerCount)
     {
         return(false);
     }
     return(abilityConditions.All(c => c.MatchesCondition(abilityObject)));
 }
 public override bool MatchesCondition(AbilityObject abilityObject)
 {
     if (abilityObject is null)
     {
         return(invert);
     }
     return(invert ? !MatchesConditionSpecific(abilityObject) : MatchesConditionSpecific(abilityObject));
 }
    public static void Create()
    {
        AbilityObject asset = ScriptableObject.CreateInstance <AbilityObject> ();

        AssetDatabase.CreateAsset(asset, "Assets/NewAbilityObject.asset");
        AssetDatabase.SaveAssets();
        EditorUtility.FocusProjectWindow();
        Selection.activeObject = asset;
    }
 protected override void ApplyEffect(AbilityObject abilityObject)
 {
     if ((abilityObject as IAbilityString)?.String is string skillIdentifier)
     {
         if (skillIdentifier != lastSkillIdentifier)
         {
             lastSkillIdentifier = skillIdentifier;
             Character.Info?.IncreaseSkillLevel(skillIdentifier, 1.0f);
         }
     }
 }
 protected override void ApplyEffect(AbilityObject abilityObject)
 {
     if ((abilityObject as IAbilityValue)?.Value is float skillIncrease)
     {
         Character.Info?.IncreaseSkillLevel(skillIdentifier, skillIncrease);
     }
     else
     {
         LogabilityObjectMismatch();
     }
 }
 protected override void ApplyEffect(AbilityObject abilityObject)
 {
     if ((abilityObject as IAbilityCharacter)?.Character is Character targetCharacter)
     {
         ApplyEffectSpecific(targetCharacter);
     }
     else
     {
         ApplyEffectSpecific(Character);
     }
 }
 protected override void ApplyEffect(AbilityObject abilityObject)
 {
     if (abilityObject is AbilityValueAffliction afflictionReduceAmount)
     {
         afflictionReduceAmount.Affliction.Strength -= addedAmountMultiplier * afflictionReduceAmount.Value;
     }
     else
     {
         LogabilityObjectMismatch();
     }
 }
 public void ApplyAbilityEffect(AbilityObject abilityObject)
 {
     if (abilityObject is null)
     {
         ApplyEffect();
     }
     else
     {
         ApplyEffect(abilityObject);
     }
 }
Beispiel #22
0
 protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
 {
     if ((abilityObject as IAbilityMission)?.Mission is Mission mission)
     {
         return(mission.Prefab.Type == missionType);
     }
     else
     {
         LogAbilityConditionError(abilityObject, typeof(IAbilityMission));
         return(false);
     }
 }
Beispiel #23
0
 protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
 {
     if ((abilityObject as IAbilityItem)?.Item is Item item)
     {
         return(item.Submarine == null || item.Submarine.TeamID != character.Info.TeamID);
     }
     else
     {
         LogAbilityConditionError(abilityObject, typeof(IAbilityItem));
         return(false);
     }
 }
 protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
 {
     if ((abilityObject as IAbilityString)?.String is string skillIdentifier)
     {
         return(MatchesConditionSpecific(skillIdentifier));
     }
     else
     {
         LogAbilityConditionError(abilityObject, typeof(IAbilityString));
         return(false);
     }
 }
Beispiel #25
0
 protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
 {
     if ((abilityObject as IAbilityAffliction)?.Affliction is Affliction affliction)
     {
         return(afflictions.Any(a => a == affliction.Identifier));
     }
     else
     {
         LogAbilityConditionError(abilityObject, typeof(IAbilityAttackResult));
         return(false);
     }
 }
 protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
 {
     if ((abilityObject as IAbilityItem)?.Item is Item item)
     {
         return(item.Submarine?.Info?.IsWreck ?? false);
     }
     else
     {
         LogAbilityConditionError(abilityObject, typeof(IAbilityItem));
         return(false);
     }
 }
Beispiel #27
0
 protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
 {
     if (abilityObject is AbilityCharacterKill abilityCharacterKill)
     {
         return(abilityCharacterKill.Killer.Submarine == null || abilityCharacterKill.Killer.TeamID != abilityCharacterKill.Killer.Submarine.TeamID);
     }
     else
     {
         LogAbilityConditionError(abilityObject, typeof(AbilityCharacterKill));
         return(false);
     }
 }
Beispiel #28
0
 void ProcessDiscreteClicks()
 {
     if (Input.GetMouseButtonUp(0))
     {
         AbilityObject c = GetCardUnderMouse();
         StartCard(c);
     }
     if (Input.GetMouseButtonUp(1))
     {
         AbilityObject c = GetCardUnderMouse();
         AbilitySlot   s = GetSlotUnderMouse();
         EndCard(c, s);
     }
 }
Beispiel #29
0
 void StartCard(AbilityObject c)
 {
     if (c != null)
     {
         if (_ability != c)
         {
             SelectAbility(c);
         }
         else
         {
             DeselectAbility(c);
         }
     }
 }
Beispiel #30
0
    void SwapCards(AbilityObject cardToSwap)
    {
        if (cardToSwap._locked || _ability._locked)
        {
            return;
        }

        AbilitySlot swapToSlot  = cardToSwap._slot;
        AbilitySlot currentSlot = _ability._slot;

        PlaceCardInSlot(cardToSwap, currentSlot);
        PlaceCardInSlot(_ability, swapToSlot);
        DeselectAbility(_ability);
    }