Beispiel #1
0
        public IObservable <Unit> OnGiveDamage(BattleSystem battleSystem, BattleCharacter attacker, BattleCharacter target)
        {
            return(Observable.Defer(() =>
            {
                var damageResult = BattleCalcurator.GetDamage(attacker, target, attackAttribute, BattleCalcurator.GetBarrageDamageRate(Level), false);
                target.TakeDamageRaw(damageResult.damage);
                battleSystem.AddLog(ScriptLocalization.UI.Sentence_Attack.Format(attacker.CurrentSpec.Name, target.CurrentSpec.Name, damageResult.damage));

                return Observable.Timer(TimeSpan.FromSeconds(1.0f)).AsUnitObservable();
            }));
        }
Beispiel #2
0
 public IObservable <Unit> OnGiveDamage(BattleSystem battleSystem, BattleCharacter attacker, BattleCharacter target)
 {
     return(Observable.Defer(() =>
     {
         var battleCharacter = BattleUtility.GetBattleCharacter(attacker, target, targetType);
         var rate = BattleCalcurator.GetAbnormalStateAddRate(abnormalStateType, Level);
         if (battleCharacter.AbnormalStateController.Lottery(abnormalStateType, rate) && battleCharacter.AbnormalStateController.Add(abnormalStateType))
         {
             battleSystem.AddLog(ScriptLocalization.UI.Sentence_AddedAbnormalState.Format(battleCharacter.CurrentSpec.Name, abnormalStateType));
             return Observable.Timer(TimeSpan.FromSeconds(1.0f)).AsUnitObservable();
         }
         else
         {
             return Observable.ReturnUnit();
         }
     }));
 }
Beispiel #3
0
        public IObservable <Unit> Invoke(BattleSystem battleSystem, BattleCharacter attacker, BattleCharacter target)
        {
            return(Observable.Defer(() =>
            {
                var damageResult = attacker.GiveDamage(target);
                battleSystem.AddLog(ScriptLocalization.UI.Sentence_Attack.Format(attacker.CurrentSpec.Name, target.CurrentSpec.Name, damageResult.damage));

                var otherStreams = new List <IObservable <Unit> >();

                otherStreams.Add(Observable.Timer(TimeSpan.FromSeconds(1.0f)).AsUnitObservable());

                foreach (var s in attacker.Skills.OfType <IOnGiveDamage>())
                {
                    otherStreams.Add(s.OnGiveDamage(battleSystem, attacker, target));
                }

                foreach (var s in target.Skills.OfType <IOnTakeDamage>())
                {
                    otherStreams.Add(s.OnTakeDamage(battleSystem, attacker, target));
                }

                return otherStreams.Concat().AsSingleUnitObservable();
            }));
        }