コード例 #1
0
        public PlayStatus Play(Character target, int roundNumber)
        {
            var applyValue = CardType == CardType.Damage || CardType == CardType.Heal
                                ? OwnerCharacter.ChangeDamageOrHealingForStamina(OwnerCharacter.GetCurrentAbilityScore(AbilityScore.Value) * EffectPercent.Value)
                                : 0;

            var failedRequirements = Requirements.Where(requirement => !requirement.Met(OwnerCharacter, target));

            if (failedRequirements.Any())
            {
                return new PlayStatus(PlayStatusDetails.FailedRequirement, CardType)
                       {
                           PlayCancelled = true, RequirementType = failedRequirements.First().Type
                       }
            }
            ;

            if (CardType == CardType.Damage)
            {
                target.Conditions.ForEach(condition => condition.Condition.ApplyEffects(OwnerCharacter, target));

                var playStatus = target.AttemptToApplyDamage(applyValue);
                target.RemoveConditions(ConditionEndsOn.AfterAttack);

                return(playStatus);
            }
            else if (CardType == CardType.Heal)
            {
                return(target.ApplyHealing(applyValue));
            }
            else if (CardType == CardType.Condition)
            {
                // if a non-stacking condition is on the target already, cancel the card play
                if (target.Conditions.Any(applied => applied.Condition.StackGroup == Condition.StackGroup))
                {
                    return new PlayStatus(PlayStatusDetails.FailedNoStack, CardType)
                           {
                               PlayCancelled = true
                           }
                }
                ;

                target.Conditions.Add(new AppliedCondition(Condition, roundNumber));
                Condition.ApplyEffects(OwnerCharacter, target);
            }

            return(new PlayStatus(PlayStatusDetails.Success, CardType));
        }
コード例 #2
0
 public override void UpdateFreeTalentPointsSilently(int delta)
 {
     OwnerCharacter.SetInt32(PlayerFields.CHARACTER_POINTS1,
                             OwnerCharacter.FreeTalentPoints + delta);
 }
コード例 #3
0
 public bool IsWithinRangeDistance(MapPoint checkPoint)
 {
     return(OwnerCharacter.IsWithinDistanceOf(Range, checkPoint));
 }