예제 #1
0
        static void Main( string[] args )
        {
            Messenger.Input = Console.ReadLine;
            Messenger.Message.Subscribe( MessageWriter );

            var hero = new HeroBattler( Messenger, "勇者", 20, 20 );
            var witch = new HeroBattler( Messenger, "魔女", 18, 18 );
            var enemy = new Battler( Messenger, "スキュラ", 20, 20 );
            var enemy2 = new Battler( Messenger, "モノアイ", 16, 16 );

            var atackSkill = new Skill( "攻撃", 1, 1, Atack );
            var pluralAtackSkill = new Skill( "連続攻撃", 1, 1, PluralAtack );
            var starSkill = new Skill( "星を落とす魔法", 1, 3, StarMagic );
            var fireSkill = new Skill( "炎の剣", 2, 1, FireSlash );

            hero.AddSkill( atackSkill );
            hero.AddSkill( pluralAtackSkill );
            hero.AddSkill( fireSkill );
            witch.AddSkill( atackSkill );
            witch.AddSkill( starSkill );
            enemy.AddSkill( atackSkill );
            enemy.AddSkill( pluralAtackSkill );
            enemy2.AddSkill( atackSkill );

            var battle = new Battle( Messenger, new[] { hero, witch }, new[] { enemy, enemy2 } );
            var sub = battle.Run().ToMicrothread();
            while( sub.Current == BattleState.Fighting )
            {
                sub.Yield();
            }

            Console.WriteLine( "End" );
            Console.ReadLine();
        }
예제 #2
0
 public IEnumerable<EventNode> Subscribe( Battle battle, Battler doer, Battler target )
 {
     return Subscribe( battle, new[] { doer }, new[] { target } );
 }
예제 #3
0
 public bool CanExecute( Battle battle, Battler doer )
 {
     if( DoerNum.HasValue && battle.GetParty( doer, true, true ).Count() < DoerNum ) return false;
     if( GetCanExecute != null && !GetCanExecute( battle, doer ) ) return false;
     return true;
 }
예제 #4
0
 public IEnumerable<EventNode> Subscribe( Battle battle, IEnumerable<Battler> doers, Battler target )
 {
     return Subscribe( battle, doers, new[] { target } );
 }
예제 #5
0
 public IEnumerable<EventNode> Subscribe( Battle battle, Battler doer, IEnumerable<Battler> targets )
 {
     return Subscribe( battle, new[] { doer }, targets );
 }