static void Main(string[] args) { // 实例化一个名叫小明的奶妈并进行加Buff和回血,顺便还打了一声招呼 Nanny cat = new Nanny(); Console.WriteLine("我是奶妈小明"); cat.AddBuff(); cat.AddMilk(); cat.Select(new Call()); cat.Go(); Console.WriteLine("------------"); // 实例化一个名叫小强的格斗家,先加个团体Buff,再攻击小怪 Console.WriteLine("我是副C小强"); Fighter SmallC = new Fighter(); SmallC.AddBuff(); SmallC.Select(new Attack()); SmallC.Go(); Console.WriteLine("------------"); // 实例化一个主C小帅,先给自己加个Buff,然后打怪。 Console.WriteLine("我是主C"); Swordsman xuxubaobao = new Swordsman(); xuxubaobao.AddBuff(); xuxubaobao.Select(new Attack()); xuxubaobao.Go(); }
/// <summary> /// Called when the player takes damages /// </summary> /// <param name="obj">damages taken</param> public override bool OnEventCalled(object arg1, object arg2, object arg3) { TakenDamages damages = (TakenDamages)arg2; if (Fighter.ContextualId == (int)arg1 || damages.Delta <= 0) { return(false); } short statBuffDelta = (short)damages.Delta; int num = Fighter.GetAllBuffs <StatBuff>(x => x.SourceSpellId == SourceSpellId).FindAll(x => x.Duration == PunishementDelay).Sum(x => x.Delta); if (num < Delta) { if (statBuffDelta + num > (int)Delta) { statBuffDelta = (short)(Delta - num); } StatBuff buff = new StatBuff((uint)Fighter.BuffIdProvider.Pop(), StatDefinition, (uint)GetBuffEffectType(StatDefinition.FieldName), statBuffDelta, PunishementDelay, Fighter.ContextualId, SourceSpellId, statBuffDelta, 0); Fighter.AddBuff(buff); } return(false); }
private IEnumerator ExecuteAbility() { Coroutine effect = null; string log = ""; if (_choosedAbility.type == Ability.AbilityType.ATTACK) { if (_choosedAbility.target == Ability.AbilityTarget.MULTI) { foreach (Fighter fighter in _fighters.FindAll(e => e.player != _activeFighter.player && e.dead == false)) { effect = StartCoroutine(fighter.TakeDamage(_choosedAbility.damage)); // TODO : clean that and move to a different component GameObject bubble = Instantiate(damageBubble, new Vector3(fighter.transform.position.x, fighter.transform.position.y, 0f), Quaternion.identity, _activeFighter.transform.parent.parent); bubble.GetComponentInChildren <DamageTextAnimation>().ChangeText(_choosedAbility.damage.ToString()); } log = _activeFighter.name + " attack the enemies with " + _choosedAbility.abilityName; } else { effect = StartCoroutine(_fighterToAttack.TakeDamage(_choosedAbility.damage)); // TODO : clean that and move to a different component GameObject bubble = Instantiate(damageBubble, new Vector3(_fighterToAttack.transform.position.x, _fighterToAttack.transform.position.y, 0f), Quaternion.identity, _activeFighter.transform.parent.parent); bubble.GetComponentInChildren <DamageTextAnimation>().ChangeText(_choosedAbility.damage.ToString()); log = _activeFighter.name + " attack " + _fighterToAttack.name + " with " + _choosedAbility.abilityName; } } else { if (_choosedAbility.target == Ability.AbilityTarget.MULTI) { foreach (Fighter fighter in _fighters.FindAll(e => e.player == _activeFighter.player && e.dead == false)) { effect = StartCoroutine(fighter.Heal(_choosedAbility.heal)); } log = _activeFighter.name + " heal all alies with " + _choosedAbility.abilityName; } else { effect = StartCoroutine(_fighterToAttack.Heal(_choosedAbility.heal)); log = _activeFighter.name + " heal " + _fighterToAttack.name + " with " + _choosedAbility.abilityName; } } // Add debuff foreach (Status debuff in _choosedAbility.debuffs) { if (_choosedAbility.target == Ability.AbilityTarget.MULTI) { foreach (Fighter enemy in _fighters.FindAll(e => e.player != _activeFighter.player && e.dead == false)) { enemy.AddDebuff(debuff); } } else { _fighterToAttack.AddDebuff(debuff); } } // Add buff foreach (Status buff in _choosedAbility.buffs) { if (_choosedAbility.target == Ability.AbilityTarget.MULTI) { foreach (Fighter ally in _fighters.FindAll(e => e.player == _activeFighter.player && e.dead == false)) { ally.AddBuff(buff); } } else { _activeFighter.AddBuff(buff); } } // Display combat log EventManager.TriggerEvent(EventList.DISPLAY_TEXT.ToString(), new { text = log }); while (!CombatLogManager.instance.doneDisplaying) { yield return(null); } yield return(effect); }