public ActionCommand(int userUnitIndex, int targetUnitIndex, ActionEffect[] effects, ActionEffect[] userEffects/*, int bonusDamage = 0*/) { UserUnitIndex = userUnitIndex; TargetUnitIndex = targetUnitIndex; TargetEffects = effects; UserEffects = userEffects; }
public void ApplyDoesNothingWithoutFunctionPtr_ExpectedBehavior() { var ctx = new MyContext(); var e = new ActionEffect <MyContext>("Name", EffectType.PlanOnly, null); e.Apply(ctx); }
public StatDecorator(StatDecorator copyFrom) { this.stat = copyFrom.stat; this.value = copyFrom.value; this.isFactor = copyFrom.isFactor; this.actionEffect = copyFrom.actionEffect; }
public Pathfinding(Procedural.Carre.MapGenerator gm) { GM = gm; Legal = DefaultLegalCheck; //Tout ce qui est dans la map est legal MoveEffect = DefaultMoveEffect; //deplace le unit game object AttackEffect = DefaultAttackEffect; //Par default ne fait rien, pour ajouter une attack, ajouter une fonction dans attackeffect CanAttack = DefaultCanAttack; //par default false, pour activer la detection d<attaque, ajouter une fonction dans le delagate canattack }
public void ApplyCallsInternalFunctionPtr_ExpectedBehavior() { var ctx = new MyContext(); var e = new ActionEffect <MyContext>("Name", EffectType.PlanOnly, (c, et) => c.Done = true); e.Apply(ctx); Assert.AreEqual(true, ctx.Done); }
public override void Defend(ActionProperty property, ActionEffect totalEffect) { // we have resist magic ! if (property.DamageKind == DamageKind.Magic) { log("resited magic!"); double dmg = property.DamageValue - MagicResistance; ActionProperty resistedProperty = new ActionProperty(property); resistedProperty.DamageValue = Math.Min(0, dmg); return; } base.Receive(property, totalEffect); }
// ========================================================= EFFECTS /// <summary> /// Effects can be added to an Action / primitive task. /// </summary> /// <param name="name"></param> /// <param name="effectType"></param> /// <param name="action"></param> /// <returns></returns> public DB Effect(string name, EffectType effectType, Action <T, EffectType> action) { if (Pointer is IPrimitiveTask task) { var effect = new ActionEffect <T>(name, effectType, action); task.AddEffect(effect); } else { throw new Exception("Tried to add an Effect, but the Pointer is not a Primitive Task!"); } return((DB)this); }
ActionEffect Apply(Wizzard entity) { // evaluate var effect = new ActionEffect(); foreach (var property in Properties) { entity.Defend(property, effect); } // then apply entity.Apply(effect); // return the spell total effects for pretty printing return(effect); }
public static void AddActionEffects <TOwner>(this ModelBuilder builder, TOwner owner, IEnumerable <ActionEffect> effects, Expression <Func <TOwner, IEnumerable <ActionEffect> > > collectionSelector) where TOwner : BaseEntity { ActionEffect[] effectsArray = effects.ToArray(); for (int i = 0; i < effectsArray.Length; i++) { ActionEffect effect = effectsArray[i]; builder.AddTextBlocks(effect, effect.Effects, e => e.Effects); effect.Effects = new TextBlock[0]; effect.OwnerId = owner.Id; builder.AddData(effect); } }
private void AffectActionEffect(ActionEffect effect) { switch (effect) { case BlowOffEffect blowOffEffect: _rigidbody2D.AddForce(blowOffEffect.Power * 20, ForceMode2D.Impulse); _ignoreTime = blowOffEffect.Duration * 0.1f; break; case SlowMoveEffect slowMoveEffect: _currentMoveSpeed = DefaultMoveSpeed * 0.3f; _slowTime = slowMoveEffect.DurationSeconds; break; } }
public void Apply(ActionEffect effect) { // self damage foreach (var byKind in effect.DamageByKind) { this.hp -= byKind.Value; } // let's say we can't move for X seconds foreach (var neutralized in effect.NeutralizedActions) { Actions[neutralized.Key].NextAvailable += neutralized.Value; } // armor damage? foreach (var equipmentDamage in effect.EquipmentDamage) { equipment[equipmentDamage.Key].Damage += equipmentDamage.Value; } }
private void ApplyEffect(ActionEffect e) { switch (e) { case BlowOffEffect blowOffEffect: _blowOffTime = blowOffEffect.Duration; _rigidbody2D.AddForce(blowOffEffect.Power * 100, ForceMode2D.Impulse); break; case SlowMoveEffect slowMoveEffect: _currentMoveSpeed = MaxMoveSpeed * 0.1f; if (_rigidbody2D.velocity.magnitude > _currentMoveSpeed) { _rigidbody2D.velocity = _rigidbody2D.velocity.normalized * _currentMoveSpeed; } _slowDuration = slowMoveEffect.DurationSeconds; break; } }
public void SetsType_ExpectedBehavior() { var e = new ActionEffect <MyContext>("Name", EffectType.PlanOnly, null); Assert.AreEqual(EffectType.PlanOnly, e.Type); }
public void Affect(ActionEffect effect) { _currentActionEffect.Value = effect; }
public void RemoveEffect(ActionEffect effect) { effectList.Remove(effect); CheckEffectsDone(); }
public void ApplyThrowsIfBadContext_ExpectedBehavior() { var e = new ActionEffect <MyContext>("Name", EffectType.PlanOnly, null); e.Apply(null); }
public virtual void Defend(ActionProperty property, ActionEffect totalEffect) { // no defence }
public void AddActionEffect(ActionEffect actionEffect) { ActiveActionEffects.Add(actionEffect); }
// Event Invoke private void InvokePlayerHit(TargetableEntityBehaviour target) { if (!entityManager.Player.IsPlaying("throw")) { entityManager.Player.PlayAnimation("throw"); } var effect = new ActionEffect(() => { entityManager.ThrowSnowball(target); }); ApplyEffect(new DelayedEffect(effect,TimeSpan.FromMilliseconds(200))); }