private void ApplyEffect(Actor target, Actor source) { switch (BaseEffect.effectType) { case EffectType.DEBUFF: case EffectType.BUFF: string buffName = sourceName + BaseEffect.statBonusType.ToString() + BaseEffect.statModifyType.ToString(); ApplyBuffEffect(target, source, buffName); return; case EffectType.BLEED: case EffectType.BURN: case EffectType.CHILL: case EffectType.ELECTROCUTE: case EffectType.FRACTURE: case EffectType.PACIFY: case EffectType.RADIATION: case EffectType.POISON: float effectPowerMultiplier = source.Data.OnHitData.effectData[BaseEffect.effectType].Effectiveness; ActorEffect.ApplyEffectToTarget(target, source, BaseEffect.effectType, Value * effectPowerMultiplier * target.Data.AfflictedStatusDamageResistance, source.Data.OnHitData.effectData[BaseEffect.effectType].Duration); break; default: ActorEffect.ApplyEffectToTarget(target, source, BaseEffect.effectType, Value, BaseEffect.effectDuration, 1.0f, BaseEffect.effectElement); return; } }
private void UpdateStatuses() { System.Collections.Generic.List <ActorEffect> bleedList = actor.GetStatusEffectAll(EffectType.BLEED); if (bleedList.Count > 0) { statusText.text += "<sprite=13>"; if (bleedList.Count > 1) { statusText.text += "x" + bleedList.Count + "\n"; } else { statusText.text += bleedList[0].GetEffectValue().ToString("N0") + "/s " + bleedList[0].duration.ToString("F1") + "\n"; } } System.Collections.Generic.List <ActorEffect> poisonList = actor.GetStatusEffectAll(EffectType.POISON); if (poisonList.Count > 0) { statusText.text += "<sprite=14>x" + poisonList.Count + "\n"; } ActorEffect burn = actor.GetStatusEffect(EffectType.BURN); if (burn != null) { statusText.text += "<sprite=1> " + burn.GetEffectValue().ToString("N0") + "/s " + burn.duration.ToString("F1") + "s\n"; } ActorEffect chill = actor.GetStatusEffect(EffectType.CHILL); if (chill != null) { statusText.text += "<sprite=2> " + chill.GetEffectValue().ToString("N0") + "% " + chill.duration.ToString("F1") + "s\n"; } if (actor.GetStatusEffect(EffectType.ELECTROCUTE) is ElectrocuteEffect electrocute) { statusText.text += "<sprite=3> " + electrocute.GetEffectValue().ToString("N0") + "/s " + electrocute.duration.ToString("F1") + "s\n"; } if (actor.GetStatusEffect(EffectType.FRACTURE) is FractureEffect fracture) { statusText.text += "<sprite=4> " + fracture.GetEffectValue().ToString("N0") + "% " + fracture.duration.ToString("F1") + "s\n"; } if (actor.GetStatusEffect(EffectType.PACIFY) is PacifyEffect pacify) { statusText.text += "<sprite=5> " + pacify.GetEffectValue().ToString("N0") + "% " + pacify.duration.ToString("F1") + "s\n"; } if (actor.GetStatusEffect(EffectType.RADIATION) is RadiationEffect radiation) { statusText.text += "<sprite=6> " + radiation.GetEffectValue().ToString("N0") + "/s " + radiation.duration.ToString("F1") + "s\n"; } }
public static void ApplyStatusSpreadEffect(Actor target, Actor source, EffectType effectType, LayerMask mask) { List <ActorEffect> effectsToApply = new List <ActorEffect>(); switch (effectType) { case EffectType.SPREAD_STATUSES: effectsToApply.Add(target.GetStatusEffect(EffectType.BLEED)); effectsToApply.Add(target.GetStatusEffect(EffectType.BURN)); effectsToApply.Add(target.GetStatusEffect(EffectType.CHILL)); effectsToApply.Add(target.GetStatusEffect(EffectType.ELECTROCUTE)); effectsToApply.Add(target.GetStatusEffect(EffectType.FRACTURE)); effectsToApply.Add(target.GetStatusEffect(EffectType.PACIFY)); effectsToApply.Add(target.GetStatusEffect(EffectType.RADIATION)); break; case EffectType.SPREAD_BURN: effectsToApply.Add(target.GetStatusEffect(EffectType.BURN)); break; case EffectType.SPREAD_DAMAGING_STATUSES: effectsToApply.Add(target.GetStatusEffect(EffectType.BLEED)); effectsToApply.Add(target.GetStatusEffect(EffectType.BURN)); effectsToApply.Add(target.GetStatusEffect(EffectType.ELECTROCUTE)); effectsToApply.Add(target.GetStatusEffect(EffectType.RADIATION)); break; case EffectType.SPREAD_BLEED: effectsToApply.Add(target.GetStatusEffect(EffectType.BLEED)); break; case EffectType.SPREAD_RADIATION: effectsToApply.Add(target.GetStatusEffect(EffectType.RADIATION)); break; } Collider2D[] hits = Physics2D.OverlapCircleAll(target.transform.position, 1f, mask); foreach (Collider2D hit in hits) { Actor secondary = hit.gameObject.GetComponent <Actor>(); if (secondary.Data.IsDead || secondary == target) { continue; } foreach (ActorEffect effect in effectsToApply) { if (effect != null) { ActorEffect.ApplyEffectToTarget(secondary, effect.Source, effect.effectType, effect.GetSimpleEffectValue(), effect.duration); } } } }
public void RemoveStatusEffect(ActorEffect statusEffect, bool deferUpdates) { statusEffect.OnExpire(); if (statusEffect.effectType == EffectType.BUFF || statusEffect.effectType == EffectType.DEBUFF) { buffEffects.Remove((StatBonusBuffEffect)statusEffect); } else { statusEffects.Remove(statusEffect); if (GetStatusEffect(statusEffect.effectType) == null) { actorTags.Remove(statusEffect.StatusTag); } } if (!deferUpdates) { Data.UpdateActorData(); } }
public void ApplyEffectToTarget(Actor target, EffectType effectType, float effectPower) { ActorEffect.ApplyEffectToTarget(target, SourceActor, effectType, effectPower, effectData[effectType].Duration); }
public static Record CreateRecord(string Tag) { Record outRecord; switch (Tag) { case "TES4": outRecord = new Header(); break; case "GMST": outRecord = new GameSetting(); break; case "TXST": outRecord = new TextureSet(); break; case "MICN": outRecord = new MenuIcon(); break; case "GLOB": outRecord = new GlobalVariable(); break; case "CLAS": outRecord = new Class(); break; case "FACT": outRecord = new Faction(); break; case "HDPT": outRecord = new HeadPart(); break; case "HAIR": outRecord = new Hair(); break; case "EYES": outRecord = new Eyes(); break; case "RACE": outRecord = new Race(); break; case "SOUN": outRecord = new Sound(); break; case "ASPC": outRecord = new AcousticSpace(); break; case "MGEF": outRecord = new MagicEffect(); break; case "SCPT": outRecord = new Script(); break; case "LTEX": outRecord = new LandscapeTexture(); break; case "ENCH": outRecord = new ObjectEffect(); break; case "SPEL": outRecord = new ActorEffect(); break; case "ACTI": outRecord = new ESPSharp.Records.Activator(); break; case "TACT": outRecord = new TalkingActivator(); break; case "TERM": outRecord = new Terminal(); break; case "ARMO": outRecord = new Armor(); break; case "BOOK": outRecord = new Book(); break; case "CONT": outRecord = new Container(); break; case "DOOR": outRecord = new Door(); break; case "INGR": outRecord = new Ingredient(); break; case "LIGH": outRecord = new Light(); break; case "MISC": outRecord = new MiscItem(); break; case "STAT": outRecord = new Static(); break; case "SCOL": outRecord = new StaticCollection(); break; case "MSTT": outRecord = new MoveableStatic(); break; case "PWAT": outRecord = new PlaceableWater(); break; case "GRAS": outRecord = new Grass(); break; case "TREE": outRecord = new Tree(); break; case "FURN": outRecord = new Furniture(); break; case "WEAP": outRecord = new Weapon(); break; case "AMMO": outRecord = new Ammunition(); break; case "NPC_": outRecord = new NonPlayerCharacter(); break; case "CREA": outRecord = new Creature(); break; case "LVLC": outRecord = new LeveledCreature(); break; case "LVLN": outRecord = new LeveledNPC(); break; case "KEYM": outRecord = new Key(); break; case "ALCH": outRecord = new Ingestible(); break; case "IDLM": outRecord = new IdleMarker(); break; case "NOTE": outRecord = new Note(); break; case "COBJ": outRecord = new ConstructibleObject(); break; case "PROJ": outRecord = new Projectile(); break; case "LVLI": outRecord = new LeveledItem(); break; case "WTHR": outRecord = new Weather(); break; case "CLMT": outRecord = new Climate(); break; case "REGN": outRecord = new Region(); break; case "NAVI": outRecord = new NavigationMeshInfoMap(); break; case "DIAL": outRecord = new DialogTopic(); break; case "QUST": outRecord = new Quest(); break; case "IDLE": outRecord = new IdleAnimation(); break; case "PACK": outRecord = new Package(); break; case "CSTY": outRecord = new CombatStyle(); break; case "LSCR": outRecord = new LoadScreen(); break; case "ANIO": outRecord = new AnimatedObject(); break; case "WATR": outRecord = new Water(); break; case "EFSH": outRecord = new EffectShader(); break; case "EXPL": outRecord = new Explosion(); break; case "DEBR": outRecord = new Debris(); break; case "IMGS": outRecord = new ImageSpace(); break; case "IMAD": outRecord = new ImageSpaceAdapter(); break; case "FLST": outRecord = new FormList(); break; case "PERK": outRecord = new Perk(); break; case "BPTD": outRecord = new BodyPartData(); break; case "ADDN": outRecord = new AddonNode(); break; case "AVIF": outRecord = new ActorValueInformation(); break; case "RADS": outRecord = new RadiationStage(); break; case "CAMS": outRecord = new CameraShot(); break; case "CPTH": outRecord = new CameraPath(); break; case "VTYP": outRecord = new VoiceType(); break; case "IPCT": outRecord = new Impact(); break; case "IPDS": outRecord = new ImpactDataSet(); break; case "ARMA": outRecord = new ArmorAddon(); break; case "ECZN": outRecord = new EncounterZone(); break; case "MESG": outRecord = new Message(); break; case "RGDL": outRecord = new Ragdoll(); break; case "DOBJ": outRecord = new DefaultObjectManager(); break; case "LGTM": outRecord = new LightingTemplate(); break; case "MUSC": outRecord = new MusicType(); break; case "IMOD": outRecord = new ItemMod(); break; case "REPU": outRecord = new Reputation(); break; case "RCPE": outRecord = new Recipe(); break; case "RCCT": outRecord = new RecipeCategory(); break; case "CHIP": outRecord = new CasinoChip(); break; case "CSNO": outRecord = new Casino(); break; case "LSCT": outRecord = new LoadScreenType(); break; case "MSET": outRecord = new MediaSet(); break; case "ALOC": outRecord = new MediaLocationController(); break; case "CHAL": outRecord = new Challenge(); break; case "AMEF": outRecord = new AmmoEffect(); break; case "CCRD": outRecord = new CaravanCard(); break; case "CMNY": outRecord = new CaravanMoney(); break; case "CDCK": outRecord = new CaravanDeck(); break; case "DEHY": outRecord = new DehydrationStage(); break; case "HUNG": outRecord = new HungerStage(); break; case "SLPD": outRecord = new SleepDeprivationStage(); break; case "CELL": outRecord = new Cell(); break; case "WRLD": outRecord = new Worldspace(); break; case "LAND": outRecord = new GenericRecord(); break; case "NAVM": outRecord = new NavigationMesh(); break; case "INFO": outRecord = new DialogResponse(); break; case "REFR": outRecord = new Reference(); break; case "ACHR": outRecord = new PlacedNPC(); break; case "ACRE": outRecord = new PlacedCreature(); break; case "PGRE": outRecord = new PlacedGrenade(); break; case "PMIS": outRecord = new PlacedMissile(); break; default: Console.WriteLine("Encountered unknown record: " + Tag); outRecord = new GenericRecord(); break; } outRecord.Tag = Tag; return(outRecord); }
public void AddStatusEffect(ActorEffect statusEffect) { if (statusEffect.effectType == EffectType.BUFF || statusEffect.effectType == EffectType.DEBUFF) { if (statusEffect is SourcedActorEffect namedEffect) { buffEffects.Add(namedEffect); statusEffect.OnApply(); Data.UpdateActorData(); } else { Debug.Log("Should not have buff type."); } } else { List <ActorEffect> existingStatus = statusEffects.FindAll(x => x.GetType() == statusEffect.GetType()); if (statusEffect.Source.GetActorType() != this.GetActorType()) { statusEffect.duration *= Data.AfflictedStatusDuration; } int stackCount; if (existingStatus.Count > 0 && statusEffect.StacksIncrementExistingEffect) { stackCount = existingStatus[0].Stacks; } else { stackCount = existingStatus.Count; } if (statusEffect.StacksIncrementExistingEffect && stackCount > 0) { if (stackCount < statusEffect.MaxStacks) { existingStatus[0].SetStacks(existingStatus[0].Stacks + 1); } return; } else { if (stackCount == statusEffect.MaxStacks) { ActorEffect effectToRemove = existingStatus.Find(x => x.GetSimpleEffectValue() < statusEffect.GetSimpleEffectValue()); if (effectToRemove != null) { RemoveStatusEffect(effectToRemove, true); } else { existingStatus.OrderBy(x => x.duration).First().RefreshDuration(statusEffect.duration); return; } } else if (stackCount > statusEffect.MaxStacks) { return; } } statusEffects.Add(statusEffect); //Debug.Log(Data.Name + " " + statusEffect + " " + statusEffect.GetSimpleEffectValue()); statusEffect.OnApply(); actorTags.Add(statusEffect.StatusTag); Data.UpdateActorData(); } }