public override void Update(float deltaTime, Camera cam) { if (item.body != null && item.body.Enabled && item.body.FarseerBody.Awake) { item.SetContainedItemPositions(); } foreach (Pair <Item, StatusEffect> itemAndEffect in itemsWithStatusEffects) { Item contained = itemAndEffect.First; if (contained.Condition < 0.0f) { continue; } StatusEffect effect = itemAndEffect.Second; if (effect.Targets.HasFlag(StatusEffect.TargetType.This)) { effect.Apply(ActionType.OnContaining, deltaTime, item, item.AllPropertyObjects); } if (effect.Targets.HasFlag(StatusEffect.TargetType.Contained)) { effect.Apply(ActionType.OnContaining, deltaTime, item, contained.AllPropertyObjects); } } }
public override void Update(float deltaTime, Camera cam) { if (!string.IsNullOrEmpty(SpawnWithId) && !alwaysContainedItemsSpawned) { SpawnAlwaysContainedItems(); } if (item.ParentInventory is CharacterInventory) { item.SetContainedItemPositions(); } else if (item.body != null && item.body.Enabled && item.body.FarseerBody.Awake) { item.SetContainedItemPositions(); } else if (activeContainedItems.Count == 0) { IsActive = false; return; } foreach (var activeContainedItem in activeContainedItems) { Item contained = activeContainedItem.Item; if (activeContainedItem.ExcludeBroken && contained.Condition <= 0.0f) { continue; } StatusEffect effect = activeContainedItem.StatusEffect; if (effect.HasTargetType(StatusEffect.TargetType.This)) { effect.Apply(ActionType.OnContaining, deltaTime, item, item.AllPropertyObjects); } if (effect.HasTargetType(StatusEffect.TargetType.Contained)) { effect.Apply(ActionType.OnContaining, deltaTime, item, contained.AllPropertyObjects); } if (effect.HasTargetType(StatusEffect.TargetType.NearbyItems) || effect.HasTargetType(StatusEffect.TargetType.NearbyCharacters)) { targets.Clear(); targets.AddRange(effect.GetNearbyTargets(item.WorldPosition, targets)); effect.Apply(ActionType.OnActive, deltaTime, item, targets); } } }
public StatusEffect AddStatusEffect(string effectId, OldContext context) { Entity caster = context.entity; StatusEffect existing = statusList.Find((StatusEffect s) => { return(s.Id == effectId && s.caster == caster || s.IsUnique); }); if (existing != null && existing.IsRefreshable) { existing.Refresh(context); return(existing); } StatusEffect statusEffect = EntitySystemLoader.Instance.Create <StatusEffect>(effectId); if (existing != null) { existing.Remove(); statusList.Remove(existing); } statusEffect.Apply(entity, context); statusList.Add(statusEffect); return(statusEffect); }
private static void Cover3(AbilityBuilder builder) { builder.Create(Feat.Cover3, PerkType.Cover) .Name("Cover III") .HasRecastDelay(RecastGroup.Cover, 120f) .RequirementStamina(12) .UsesActivationType(AbilityActivationType.Casted) .DisplaysVisualEffectWhenActivating(VisualEffect.None) .HasCustomValidation((activator, target, level) => { if (activator == target) { return("You cannot Cover yourself."); } return(string.Empty); }) .HasImpactAction((activator, target, level) => { var length = 60f + GetAbilityModifier(AbilityType.Constitution, activator) * 2f; StatusEffect.Apply(activator, target, StatusEffectType.Cover3, length); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Dur_Prot_Epic_Armor), target); Enmity.ModifyEnmityOnAll(activator, 10); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.Chivalry, 3); }); }
public Dictionary <Feat, AbilityDetail> BuildAbilities() { var builder = new AbilityBuilder() .Create(Feat.Sleep, PerkType.Sleep) .Name("Sleep") .HasRecastDelay(RecastGroup.Sleep, 12f) .HasActivationDelay(2f) .RequirementMP(8) .UsesActivationType(AbilityActivationType.Casted) .DisplaysVisualEffectWhenActivating() .HasImpactAction((activator, target, level) => { var resistance = Resistance.GetResistance(target, ResistanceType.Sleep); var baseDuration = Random.NextFloat(15.0f, 30.0f); var duration = baseDuration * resistance; StatusEffect.Apply(activator, target, StatusEffectType.Sleep, duration); Resistance.ModifyResistance(target, ResistanceType.Sleep, -0.25f); CombatPoint.AddCombatPoint(activator, target, SkillType.BlackMagic, 3); Enmity.ModifyEnmity(activator, target, 18); }); return(builder.Build()); }
private static void Flash2(AbilityBuilder builder) { builder.Create(Feat.Flash2, PerkType.Flash) .Name("Flash II") .HasRecastDelay(RecastGroup.Flash, 60f) .RequirementStamina(20) .UsesActivationType(AbilityActivationType.Casted) .HasImpactAction((activator, target, level) => { var nth = 1; var nearby = GetNearestCreature(Type.IsAlive, 1, target, nth); while (GetIsObjectValid(nearby)) { if (GetDistanceBetween(target, nearby) > 5.0f) { break; } ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Pdk_Generic_Head_Hit), nearby); StatusEffect.Apply(activator, nearby, StatusEffectType.Blind2, 45f); Enmity.ModifyEnmity(activator, nearby, 50); nth++; nearby = GetNearestCreature(Type.IsAlive, 1, target, nth); } ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Pdk_Generic_Pulse), activator); }); }
//this is pseudo private public void AddStatusEffectFromTemplate(StatusEffectTemplate template) { StatusEffect effect = template.Create(entity); OldContext context = template.GetContext(entity); effect.Apply(entity, context); statusList.Add(effect); }
void SetupNewEffect(StatusEffect effect) { effect.Apply(); activeEffects.Add(effect); effect.EffectFinished += RemoveEffect; AddedNewEffect(effect); }
public override void Update(float deltaTime, Camera cam) { if (item.ParentInventory is CharacterInventory) { item.SetContainedItemPositions(); } else if (item.body != null && item.body.Enabled && item.body.FarseerBody.Awake) { item.SetContainedItemPositions(); } else if (itemsWithStatusEffects.Count == 0) { IsActive = false; return; } foreach (Pair <Item, StatusEffect> itemAndEffect in itemsWithStatusEffects) { Item contained = itemAndEffect.First; if (contained.Condition <= 0.0f) { continue; } StatusEffect effect = itemAndEffect.Second; if (effect.HasTargetType(StatusEffect.TargetType.This)) { effect.Apply(ActionType.OnContaining, deltaTime, item, item.AllPropertyObjects); } if (effect.HasTargetType(StatusEffect.TargetType.Contained)) { effect.Apply(ActionType.OnContaining, deltaTime, item, contained.AllPropertyObjects); } if (effect.HasTargetType(StatusEffect.TargetType.NearbyItems) || effect.HasTargetType(StatusEffect.TargetType.NearbyCharacters)) { var targets = new List <ISerializableEntity>(); effect.GetNearbyTargets(item.WorldPosition, targets); effect.Apply(ActionType.OnActive, deltaTime, item, targets); } } }
private static void Invincible(AbilityBuilder builder) { builder.Create(Feat.Invincible, PerkType.Invincible) .Name("Invincible") .HasRecastDelay(RecastGroup.OneHourAbility, 3600f) .UsesActivationType(AbilityActivationType.Casted) .RequirementStamina(50) .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.Invincible, 30.0f); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.Chivalry, 5); Enmity.ModifyEnmityOnAll(activator, 500); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Fnf_Sound_Burst), target); }); }
public override void ApplyStatusEffect(StatusEffect Effect) { if (effects.Find(e => e.Name == Effect.Name) && !Effect.Stackable) { effects.Find(e => e.Name == Effect.Name).Duration = Effect.Duration; return; } StatusEffect effectInstance = (StatusEffect)UnityEngine.Object.Instantiate(Effect); effects.Add(effectInstance); effectInstance.Apply(this); onStatusChanged(); }
private static void Ironclad1(AbilityBuilder builder) { builder.Create(Feat.Ironclad1, PerkType.Ironclad) .Name("Ironclad I") .HasRecastDelay(RecastGroup.Ironclad, 300f) .RequirementStamina(10) .UsesActivationType(AbilityActivationType.Casted) .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.Ironclad1, 60f); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Death_Ward), target); Enmity.ModifyEnmityOnAll(activator, 8); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.Chivalry, 3); }); }
private static void SubtleBlow2(AbilityBuilder builder) { builder.Create(Feat.SubtleBlow2, PerkType.SubtleBlow) .Name("Subtle Blow II") .HasRecastDelay(RecastGroup.SubtleBlow, 300f) .RequirementStamina(7) .UsesActivationType(AbilityActivationType.Casted) .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.SubtleBlow2, 30f); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Ac_Bonus), target); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.Chi, 3); Enmity.ModifyEnmityOnAll(activator, 8); }); }
private static void Blind1(AbilityBuilder builder) { builder.Create(Feat.Blind1, PerkType.Blind) .Name("Blind I") .HasRecastDelay(RecastGroup.Blind, 12f) .RequirementMP(6) .UsesActivationType(AbilityActivationType.Casted) .HasActivationDelay(2f) .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.Blind1, 15f); Enmity.ModifyEnmity(activator, target, 4); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.RedMagic, 3); }); }
private static void Manafont(AbilityBuilder builder) { builder.Create(Feat.Manafont, PerkType.Manafont) .Name("Manafont") .HasRecastDelay(RecastGroup.OneHourAbility, 3600f) .UsesActivationType(AbilityActivationType.Casted) .RequirementMP(50) .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.Manafont, 30f); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Fnf_Sound_Burst), target); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.RedMagic, 5); Enmity.ModifyEnmityOnAll(activator, 100); }); }
private static void WaspSting3(AbilityBuilder builder) { builder.Create(Feat.WaspSting3, PerkType.WaspSting) .Name("Wasp Sting III") .HasRecastDelay(RecastGroup.WaspSting, 60f) .RequirementStamina(12) .UsesActivationType(AbilityActivationType.Weapon) .HasImpactAction((activator, target, level) => { ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Poison_S), target); StatusEffect.Apply(activator, target, StatusEffectType.Poison3, 24f); CombatPoint.AddCombatPoint(activator, target, SkillType.Thievery, 3); Enmity.ModifyEnmity(activator, target, 20); }); }
private static void Refresh(AbilityBuilder builder) { builder.Create(Feat.Refresh, PerkType.Refresh) .Name("Refresh") .HasRecastDelay(RecastGroup.Refresh, 18f) .RequirementMP(12) .UsesActivationType(AbilityActivationType.Casted) .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.Refresh, 180f); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Head_Mind), target); Enmity.ModifyEnmityOnAll(activator, 6); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.RedMagic, 3); }); }
private static void PiercingStab3(AbilityBuilder builder) { builder.Create(Feat.PiercingStab3, PerkType.PiercingStab) .Name("Piercing Stab III") .HasRecastDelay(RecastGroup.PiercingStab, 60f) .RequirementStamina(15) .UsesActivationType(AbilityActivationType.Weapon) .HasImpactAction((activator, target, level) => { var duration = CalculateDuration(activator); StatusEffect.Apply(activator, target, StatusEffectType.Bleed3, duration); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Com_Chunk_Red_Small), target); CombatPoint.AddCombatPoint(activator, target, SkillType.RedMagic, 2); Enmity.ModifyEnmity(activator, target, 14); }); }
private static void ElementalSeal(AbilityBuilder builder) { builder.Create(Feat.ElementalSeal, PerkType.ElementalSeal) .Name("Elemental Seal") .DisplaysVisualEffectWhenActivating() .HasRecastDelay(RecastGroup.OneHourAbility, 3600f) .UsesActivationType(AbilityActivationType.Casted) .RequirementMP(50) .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.ElementalSeal, 30f); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Fnf_Howl_Mind), target); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.BlackMagic, 5); Enmity.ModifyEnmityOnAll(activator, 300); }); }
private static void DeliberateStab(AbilityBuilder builder) { builder.Create(Feat.DeliberateStab, PerkType.DeliberateStab) .Name("Deliberate Stab") .HasRecastDelay(RecastGroup.DeliberateStab, 300f) .RequirementStamina(20) .UsesActivationType(AbilityActivationType.Casted) .HasActivationDelay(2f) .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.DeliberateStab, 30f); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Divine_Strike_Holy), activator); Enmity.ModifyEnmityOnAll(activator, 3); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.RedMagic, 3); }); }
private static void Dia3(AbilityBuilder builder) { builder.Create(Feat.Dia3, PerkType.Dia) .Name("Dia III") .HasRecastDelay(RecastGroup.Dia, 3f) .HasActivationDelay(1.0f) .RequirementMP(6) .UsesActivationType(AbilityActivationType.Casted) .DisplaysVisualEffectWhenActivating() .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.Dia3, 60f); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Blind_Deaf_M), target); Enmity.ModifyEnmity(activator, target, 10); CombatPoint.AddCombatPoint(activator, target, SkillType.WhiteMagic, 3); }); }
private static void Blind2(AbilityBuilder builder) { builder.Create(Feat.Blind2, PerkType.Blind) .Name("Blind II") .HasRecastDelay(RecastGroup.Blind, 12f) .RequirementMP(10) .UsesActivationType(AbilityActivationType.Casted) .HasActivationDelay(2f) .HasImpactAction((activator, target, level) => { // Intentional to use Blind I again. StatusEffect.Apply(activator, target, StatusEffectType.Blind1, 30f); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Dazed_S), target); Enmity.ModifyEnmity(activator, target, 6); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.RedMagic, 3); }); }
public Dictionary <Feat, AbilityDetail> BuildAbilities() { var builder = new AbilityBuilder() .Create(Feat.ElementalSpread, PerkType.ElementalSpread) .Name("Elemental Spread") .HasRecastDelay(RecastGroup.ElementalSpread, 600f) .HasActivationDelay(1f) .RequirementMP(10) .UsesActivationType(AbilityActivationType.Casted) .DisplaysVisualEffectWhenActivating() .HasImpactAction((activator, target, level) => { StatusEffect.Apply(activator, target, StatusEffectType.ElementalSpread, 60f); Enmity.ModifyEnmityOnAll(activator, 10); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.BlackMagic, 3); }); return(builder.Build()); }
private static void ElectricFist3(AbilityBuilder builder) { builder.Create(Feat.ElectricFist3, PerkType.ElectricFist) .Name("Electric Fist III") .HasRecastDelay(RecastGroup.ElectricFist, 180f) .UsesActivationType(AbilityActivationType.Weapon) .RequirementStamina(14) .HasImpactAction((activator, target, level) => { var modifier = GetAbilityModifier(AbilityType.Wisdom, activator); modifier = modifier > 0 ? modifier : 0; var damage = Random.D8(3) + modifier; ApplyEffectToObject(DurationType.Instant, EffectDamage(damage, DamageType.Electrical), target); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Com_Hit_Electrical), target); StatusEffect.Apply(activator, target, StatusEffectType.Static, 30f); CombatPoint.AddCombatPoint(activator, target, SkillType.Chi, 3); Enmity.ModifyEnmityOnAll(activator, 10 + damage); }); }
private static void ApplyFireEffects(uint activator, uint target, int baseDamage, int enmity, float burnLength) { var multiplier = 1; if (StatusEffect.HasStatusEffect(activator, StatusEffectType.ElementalSeal)) { multiplier = 3; } var damage = baseDamage * multiplier; ApplyDamage(activator, target, damage); if (burnLength > 0.0f) { StatusEffect.Apply(activator, target, StatusEffectType.Burn, burnLength); } CombatPoint.AddCombatPoint(activator, target, SkillType.BlackMagic, 3); Enmity.ModifyEnmity(activator, target, enmity); }
private static void Defender3(AbilityBuilder builder) { builder.Create(Feat.Defender3, PerkType.Defender) .Name("Defender III") .HasRecastDelay(RecastGroup.Defender, 300f) .RequirementStamina(25) .UsesActivationType(AbilityActivationType.Casted) .HasImpactAction((activator, target, level) => { foreach (var member in Party.GetAllPartyMembersWithinRange(target, 5.0f)) { StatusEffect.Apply(activator, member, StatusEffectType.Defender3, 60f); ApplyEffectToObject(DurationType.Instant, EffectVisualEffect(VisualEffect.Vfx_Imp_Death_Ward), member); Enmity.ModifyEnmityOnAll(activator, 4); } Enmity.ModifyEnmityOnAll(activator, 6); CombatPoint.AddCombatPointToAllTagged(activator, SkillType.Chivalry, 3); }); }
private void ApplyStatus(object sender, object args) { Tile tile = args as Tile; if (!tile || !tile.content) { return; } Unit target = tile.content.GetComponent <Unit>(); StatusEffect appliedEffect = null; switch (effect) { case StatusEffects.Poison: appliedEffect = target.gameObject.AddComponent <PoisionStatusEffect>(); break; } appliedEffect.Apply(intensity, duration); }
public static void GiveEffect() { var player = GetLastUsedBy(); StatusEffect.Apply(player, player, StatusEffectType.Invincible, 30.0f); }
public override void Update(float deltaTime, Camera cam) { if (!string.IsNullOrEmpty(SpawnWithId) && !alwaysContainedItemsSpawned) { SpawnAlwaysContainedItems(); } if (item.ParentInventory is CharacterInventory ownerInventory) { item.SetContainedItemPositions(); if (AutoInject) { if (ownerInventory?.Owner is Character ownerCharacter && ownerCharacter.HealthPercentage / 100f <= AutoInjectThreshold && ownerCharacter.HasEquippedItem(item)) { foreach (Item item in Inventory.AllItemsMod) { item.ApplyStatusEffects(ActionType.OnUse, 1.0f, ownerCharacter); item.GetComponent <GeneticMaterial>()?.Equip(ownerCharacter); } } } } else if (item.body != null && item.body.Enabled && item.body.FarseerBody.Awake) { item.SetContainedItemPositions(); } else if (activeContainedItems.Count == 0) { IsActive = false; return; } foreach (var activeContainedItem in activeContainedItems) { Item contained = activeContainedItem.Item; if (activeContainedItem.ExcludeBroken && contained.Condition <= 0.0f) { continue; } StatusEffect effect = activeContainedItem.StatusEffect; if (effect.HasTargetType(StatusEffect.TargetType.This)) { effect.Apply(ActionType.OnContaining, deltaTime, item, item.AllPropertyObjects); } if (effect.HasTargetType(StatusEffect.TargetType.Contained)) { effect.Apply(ActionType.OnContaining, deltaTime, item, contained.AllPropertyObjects); } if (effect.HasTargetType(StatusEffect.TargetType.NearbyItems) || effect.HasTargetType(StatusEffect.TargetType.NearbyCharacters)) { targets.Clear(); targets.AddRange(effect.GetNearbyTargets(item.WorldPosition, targets)); effect.Apply(ActionType.OnActive, deltaTime, item, targets); } } }
public void ApplyStatus(StatusEffect effect) { statusEffects.Add(effect); effect.Apply(Entity); }