public void UpdateSpecialSkillValue(IAbilitySkill skill, Func <IAbilityUnit, float, double> newGetValue) { var valueHolder = this.specialSkillValues[skill.SkillHandle]; valueHolder.GetSpecialValue = newGetValue; this.ValueChanged.Notify(); }
public DamageBlockEffectApplierWorker( IAbilitySkill skill, bool updateWithLevel, Func <IAbilitySkill, float> valueGetter) : base(updateWithLevel) { this.ValueGetter = valueGetter; this.Skill = skill; this.ApplyEffectActionGetter = () => { return(unit => { this.Value = this.ValueGetter.Invoke(this.Skill); unit.DamageManipulation.AddDamageBlock(this.Skill.SkillHandle, this.Value); }); }; this.RemoveEffectActionGetter = () => unit => { unit.DamageManipulation.RemoveDamageBlock(this.Skill.SkillHandle); }; this.UpdateEffectActionGetter = () => { return(unit => { this.Value = this.ValueGetter.Invoke(this.Skill); unit.DamageManipulation.UpdateDamageBlock(this.Skill.SkillHandle, this.Value); }); }; }
internal StringDataDamageCalculatorWorker( IAbilitySkill skill, IAbilityUnit target, ISkillManipulatedDamageCalculatorWorker manipulatedDamageWorker) : base(skill, target, manipulatedDamageWorker) { }
public ChargesItemOverlay(IAbilitySkill skill) : base(skill) { this.primaryNumber = new Number(NumberTextureColor.Default, true) { Value = 0 }; this.secondaryNumber = new Number(NumberTextureColor.Default, true) { Value = 0 }; skill.Charges.PrimaryProvider.Subscribe( new DataObserver <uint>( u => { this.primaryText.Text = u.ToString(); this.primaryNumber.Value = (int)u; this.OnPositionSet(); })); skill.Charges.SecondaryProvider.Subscribe( new DataObserver <uint>( u => { this.secondaryText.Text = u.ToString(); this.secondaryNumber.Value = (int)u; this.OnPositionSet(); })); }
public BristlebackEffectApplier(IAbilitySkill skill) : base(skill) { var worker = new EffectApplierWorker( false, () => { return(unit => { unit.DamageManipulation.DamageReduction.AddSpecialSkillValue( skill, (abilityUnit, damageValue) => { var angle = unit.SourceUnit.FindRelativeAngle(abilityUnit.Position.Current) % (2 * Math.PI * 180) / Math.PI; if (angle >= 110 && angle <= 250) { return (1 + skill.Level.Current) * 0.08; } else if (angle >= 70 && angle <= 290) { return (1 + skill.Level.Current) * 0.04; } return 0; }); }); }, () => unit => { unit.DamageManipulation.DamageReduction.RemoveSpecialSkillValue(skill); }, null); this.Workers.Add(worker); }
public DamageReductionEffectApplierWorker( IAbilitySkill skill, bool updateWithLevel, Func <IAbilitySkill, double> valueGetter) : base(updateWithLevel) { this.Skill = skill; this.ValueGetter = valueGetter; this.ApplyEffectActionGetter = () => { return(unit => { this.Value = this.ValueGetter.Invoke(this.Skill); unit.DamageManipulation.DamageReduction.AddSkillValue(skill, this.Value); }); }; this.RemoveEffectActionGetter = () => unit => { unit.DamageManipulation.DamageReduction.RemoveSkillValue(skill, this.Value); }; this.UpdateEffectActionGetter = () => { return(unit => { this.Value = this.ValueGetter.Invoke(this.Skill); unit.DamageManipulation.DamageReduction.UpdateSkillValue(skill, this.Value); }); }; }
public InvokerSkillCastData(IAbilitySkill skill, uint quasCount, uint wexCount, uint exortCount) : base(skill) { this.QuasCount = quasCount; this.WexCount = wexCount; this.ExortCount = exortCount; }
public CastSkill(OrderType orderType, IAbilitySkill skill, Func <bool> executeFunction) : base(orderType, skill.Owner, "Cast skill " + skill.Name) { this.Skill = skill; this.ExecutionInterval = this.Skill.IsItem ? 250 : (float)(this.Skill.CastData.CastPoint * 250); this.ExecuteAction = executeFunction; this.Color = Color.GreenYellow; }
public ManaBurnDamageCalculatorWorker( IAbilitySkill skill, IAbilityUnit target, ISkillManipulatedDamageCalculatorWorker manipulatedDamageWorker, float burnAmount) : base(skill, target, manipulatedDamageWorker) { this.burnAmount = burnAmount; }
internal SkillDamageCalculator(IAbilitySkill skill) { this.Skill = skill; this.DamageType = skill.SourceAbility.DamageType; if (this.DamageType == DamageType.None) { this.DamageType = DamageType.Magical; } }
public void UpdateSkillValue(IAbilitySkill skill, double newValue) { var valueHolder = this.skillValues[skill.SkillHandle]; this.value -= valueHolder.Value; valueHolder.Value = newValue; this.value += newValue; this.ValueChanged.Notify(); }
/// <summary>Initializes a new instance of the <see cref="SkillRawDamageCalculatorWorker" /> class.</summary> /// <param name="skill">The skill.</param> /// <param name="target">The target.</param> /// <param name="manipulatedDamageWorker">The manipulated damage worker.</param> protected SkillRawDamageCalculatorWorker( IAbilitySkill skill, IAbilityUnit target, ISkillManipulatedDamageCalculatorWorker manipulatedDamageWorker) { this.Skill = skill; this.Target = target; this.ManipulatedDamageWorker = manipulatedDamageWorker; this.levelObserver = new DataObserver <ISkillLevel>(level => { this.UpdateRawDamage(); }); this.levelObserver.Subscribe(this.Skill.Level); }
public CastPointSpellOverlay(IAbilitySkill skill) : base(skill) { this.abilityPhaseNumber = new Number(NumberTextureColor.Red, true); // this.abilityPhaseObserver = new DataObserver<AbilityPhase>( // phase => // { // if (phase.Running) // { // this // } // }); }
public void ItemAdded(IAbilitySkill item) { var newDict = new Dictionary <AbilityId, ItemObserver>(this.all); foreach (var itemObserver in newDict) { if (itemObserver.Value.ItemIds.Contains(item.SourceItem.Id) || itemObserver.Value.ItemId == item.SourceItem.Id) { itemObserver.Value.ItemAdded(item); break; } } }
public SkillOverlay(IAbilitySkill skill) { this.Skill = skill; this.icon = new DrawRect(skill.Texture); this.blueOverlay = new DrawRect(new Color(20, 20, 100, 220)); this.blackOverlay = new DrawRect(new Color(40, 40, 40, 180)); this.CooldownText = new DrawText { Text = string.Empty, Color = Color.FloralWhite, FontFlags = FontFlags.None, Shadow = true }; this.manaText = new DrawText { Text = string.Empty, Color = new Color(180, 200, 255), FontFlags = FontFlags.None, Shadow = true }; this.BorderColor = this.NotLearnedColor; this.cooldownNumber = new Number( NumberTextureColor.Default, true, this.Skill.Owner.ScreenInfo.HealthBarSize.Y / 2); this.manaNumber = new Number(NumberTextureColor.Blue, true); this.Skill.DisposeNotifier.Subscribe(this.Dispose); if (this.Skill.Cooldown == null) { return; } this.manaObserver = new DataObserver <IMana>(this.OnNext); this.manaObserver.Subscribe(this.Skill.Owner.Mana); this.OnNext(this.Skill.Owner.Mana); this.coolDownObserver = new DataObserver <ICooldown>(this.OnNext); this.coolDownObserver.Subscribe(this.Skill.Cooldown); this.offCooldownObserver = new DataObserver <ICooldown>( cooldown => { if (!this.Skill.CastData.EnoughMana) { this.BorderColor = this.NotEnoughManaColor; return; } this.BorderColor = this.ReadyColor; }); this.offCooldownObserver.Subscribe(this.Skill.Cooldown.OffCooldownProvider); }
public InvokerSkillOverlay(IAbilitySkill skill) : base(skill) { var skillbook = skill.Owner.SkillBook as InvokerSkillBook; DelayAction.Add( 200, () => { skillbook?.Invoke.AbilityCast.Subscribe( new DataObserver <AbilityCast>(cast => { this.Update(); })); }); this.Skill.Owner.Visibility.BecomeVisibleNotifier.Subscribe(this.Update); this.Update(); }
/// <summary> /// The compose uncontrollable skill. /// </summary> /// <param name="skill"> /// The skill. /// </param> public virtual void ComposeUncontrollableSkill(IAbilitySkill skill) { // if (skill.SourceAbility.IsAbilityBehavior(AbilityBehavior.UnitTarget)) // { // if (skill.AreaOfEffect == null && skill.Json.HasProjectile) // { // skill.AreaOfEffect = new ProjectileAreaOfEffect(skill); // } // if (skill.SkillTargetFind == null) // { // skill.SkillTargetFind = new ProjectileAreaOfEffectTargetFind(skill); // } // } // else if (skill.SourceAbility.IsAbilityBehavior(AbilityBehavior.AreaOfEffect) // || skill.SourceAbility.IsAbilityBehavior(AbilityBehavior.Point)) // { // if (skill.AreaOfEffect == null) // { // var properties = skill.SourceAbility.CommonProperties(); // if (!string.IsNullOrEmpty(properties?.Width)) // { // skill.AreaOfEffect = new LinearAreaOfEffect(skill); // } // else // { // skill.AreaOfEffect = new RadialAreaOfEffect(skill); // } // } // if (skill.SkillTargetFind == null) // { // skill.SkillTargetFind = new LinearAreaOfEffectTargetFind(skill); // } // } // else // { // if (skill.AreaOfEffect == null) // { // skill.AreaOfEffect = new RadialAreaOfEffect(skill); // } // if (skill.SkillTargetFind == null) // { // skill.SkillTargetFind = new RadialAreaOfEffectTargetFind(skill); // } // } }
public AbilityAction(IAbilityUnit source, AbilityActionType type, IAbilitySkill skill = null) { if (source != null) { this.Id = source.UnitHandle + (uint)type; } if (skill != null) { this.Id += skill.SkillHandle; } this.Type = type; this.Skill = skill; this.Source = source; this.CastingId = this.Id + 1; this.ExecutionId = this.Id + 2; }
/// <summary>The compose.</summary> /// <param name="skill">The skill.</param> public override void Compose(IAbilitySkill skill) { base.Compose(skill); var skillAddedObserver = new DataObserver <IAbilitySkill>( add => { if (add.IsItem && add.SourceItem.Id == AbilityId.item_ultimate_scepter) { skill.AddPart <IModifierGenerator>( abilitySkill => new ModifierGenerator(skill) { Workers = new List <ModifierGeneratorWorker> { new ModifierGeneratorWorker( "modifier_centaur_stampede", modifier => modifier.AssignModifierEffectApplier( new ModifierEffectApplier(modifier) { Workers = new List <IEffectApplierWorker> { new DamageReductionEffectApplierWorker ( modifier, false, abilityModifier => 0.6) } }), false, true, true) } }); } }); skillAddedObserver.Subscribe(skill.Owner.SkillBook.SkillAdded); skill.DisposeNotifier.Subscribe(() => skillAddedObserver.Dispose()); }
public SpellOverlay(IAbilitySkill skill) : base(skill) { // this.levelText = new DrawText // { Color = Color.White, Shadow = true, Text = this.Skill.Level.Current.ToString() }; this.levelNumber = new Number(NumberTextureColor.Default, true) { Value = (int)this.Skill.Level.Current }; this.levelObserver = new DataObserver <ISkillLevel>( level => { // this.levelText.Text = level.Current.ToString(); this.levelNumber.Value = (int)level.Current; this.OnSizeSet(); this.OnPositionSet(); }); this.levelObserver.Subscribe(this.Skill.Level); this.levelTextBackground = new DrawRect(new Color(0, 0, 0, 210)); DelayAction.Add(100, this.OnPositionSet); }
public void ItemRemoved(IAbilitySkill item) { if (this.Multiple) { Console.WriteLine("removing multiple"); this.count--; if (this.Item.SkillHandle.Equals(item.SkillHandle)) { this.Item = this.Items.First().Value; return; } this.Items.Remove(item.SkillHandle); if (this.count == 0) { this.Multiple = false; } return; } this.Equipped = false; this.Item = null; }
public void ItemAdded(IAbilitySkill item) { if (this.Equipped) { Console.WriteLine("adding multiple"); this.count++; if (this.Multiple) { this.Items.Add(item.SkillHandle, item); return; } this.Items = new Dictionary <uint, IAbilitySkill> { { item.SkillHandle, item } }; this.Multiple = true; return; } this.Equipped = true; this.Item = item; Console.WriteLine("adding item " + this.Item.Name + " to " + this.Item.Owner.Name); this.ItemEquipped.Notify(); }
public AbilityParticle(IAbilitySkill abilitySkill) { this.AbilitySkill = abilitySkill; }
public EffectApplier(IAbilitySkill skill) { this.Skill = skill; }
public ComboEntry(IAbilitySkill skill) { this.Cast = skill.CastFunction.Cast; }
public PhaseBootsCastFunction(IAbilitySkill skill) : base(skill) { }
public SkillLevel(IAbilitySkill skill) { this.Skill = skill; }
public AbilityProjectile(IAbilitySkill skill) { this.AbilitySkill = skill; }
public MjollnirCastFunction(IAbilitySkill skill) : base(skill) { }
protected CastFunctionBase(IAbilitySkill skill) { this.Skill = skill; }