public bool canPull(GameObject enemy) { if (enemy.GetComponent <CannotBePulled>()) { return(false); } // do not pull the enemy if they are in a high priority state if (enemy.GetComponent <StateController>() && enemy.GetComponent <StateController>().currentState&& enemy.GetComponent <StateController>().currentState.priority > 80) { return(false); } // do not pull an enemy that cannot move if (!enemy.GetComponent <NavMeshAgent>()) { return(false); } // do not pull an enemy that is snared ProtectionClass protectionClass = enemy.GetComponent <ProtectionClass>(); if (protectionClass && protectionClass.effectControl && protectionClass.effectControl.hasStatus(12)) { return(false); } return(true); }
// Use this for initialization void Start() { // subscribe to the new enemy hit event GetComponent <HitDetector>().newEnemyHitEvent += giveResources; // if it can damage the same enemy again also subscribe to the enemy hit again event if (canHitSameEnemyTwice) { GetComponent <HitDetector>().enemyHitAgainEvent += giveResources; } // get a reference to the creator's mana and protection CreationReferences references = GetComponent <CreationReferences>(); if (references) { GameObject creator = references.creator; if (creator) { if (healthOnHit != 0 || wardOnHit != 0) { creatorProtection = creator.GetComponent <ProtectionClass>(); } if (manaOnHit != 0) { creatorMana = creator.GetComponent <BaseMana>(); } } } }
// Use this for initialization protected override void Awake() { ability = AbilityIDList.getAbility(AbilityID.summonSkeleton); base.Awake(); summonWarrior = Ability.getAbility(AbilityID.summonSkeletonWarrior); summonMage = Ability.getAbility(AbilityID.summonSkeletonMage); summonArcher = Ability.getAbility(AbilityID.summonSkeletonArcher); summonWarlord = Ability.getAbility(AbilityID.summonSkeletonWarlord); summonBrawler = Ability.getAbility(AbilityID.summonSkeletonBrawler); skeletonAbilities.Add(ability); skeletonAbilities.Add(summonWarrior); skeletonAbilities.Add(summonMage); skeletonAbilities.Add(summonArcher); skeletonAbilities.Add(summonWarlord); skeletonAbilities.Add(summonBrawler); summonTracker = Comp <SummonTracker> .GetOrAdd(gameObject); summonTracker.newSummonEvent += onNewSummon; protectionClass = GetComponent <ProtectionClass>(); if (protectionClass) { health = protectionClass.healthClass; } else { health = GetComponent <BaseHealth>(); } mana = GetComponent <BaseMana>(); statBuffs = Comp <StatBuffs> .GetOrAdd(gameObject); }
// Use this for initialization protected override void Awake() { ability = AbilityIDList.getAbility(AbilityID.lightningBlast); statBuffs = GetComponent <StatBuffs>(); if (statBuffs == null) { statBuffs = gameObject.AddComponent <StatBuffs>(); } protectionClass = GetComponent <ProtectionClass>(); base.Awake(); }
private bool TryToHitEnemy(GameObject enemy) { ProtectionClass protection = enemy.GetComponent <ProtectionClass>(); if (protection) { return(!(protection.RollDodgeReturnTrueIfDodged())); } else { return(true); } }
// Use this for initialization void Start() { CreationReferences references = GetComponent <CreationReferences>(); if (references && references.creator) { creatorProtection = references.creator.GetComponent <ProtectionClass>(); } if (creatorProtection) { applied = true; Apply(creatorProtection); } }
// Use this for initialization protected override void Awake() { ability = AbilityIDList.getAbility(AbilityID.staticOrb); base.Awake(); AbilityEventListener eventListener = GetComponent <AbilityEventListener>(); if (eventListener) { eventListener.onKillEvent += OnKill; eventListener.onHitEvent += OnHit; } protectionClass = GetComponent <ProtectionClass>(); mana = GetComponent <BaseMana>(); usingAbility = GetComponent <UsingAbility>(); }
// Use this for initialization protected override void Awake() { ability = AbilityIDList.getAbility(AbilityID.nova); base.Awake(); if (GetComponent <AbilityEventListener>()) { GetComponent <AbilityEventListener>().onKillEvent += GainWardOnKill; GetComponent <AbilityEventListener>().onHitEvent += OnHit; } protectionClass = GetComponent <ProtectionClass>(); statBuffs = GetComponent <StatBuffs>(); if (!statBuffs) { statBuffs = gameObject.AddComponent <StatBuffs>(); } }
public void applyDamage(GameObject enemy) { ProtectionClass enemyProtection = enemy.GetComponent <ProtectionClass>(); if (enemyProtection) { List <HitEvents> hitEvents = enemyProtection.ApplyDamage(damageStats, gameObject); // react to the hit events CreationReferences references = GetComponent <CreationReferences>(); if (references && references.creator && references.creator.GetComponent <AbilityEventListener>()) { // get event listeners AbilityEventListener parentEventsListener = references.creator.GetComponent <AbilityEventListener>(); AbilityEventListener localEventsListener = GetComponent <AbilityEventListener>(); // call event methods if (hitEvents.Contains(HitEvents.Hit)) { parentEventsListener.HitEvent(references.thisAbility, enemy); if (localEventsListener) { localEventsListener.HitEvent(references.thisAbility, enemy); } } if (hitEvents.Contains(HitEvents.Crit)) { parentEventsListener.CritEvent(references.thisAbility, enemy); if (localEventsListener) { localEventsListener.CritEvent(references.thisAbility, enemy); } } if (hitEvents.Contains(HitEvents.Kill)) { parentEventsListener.KillEvent(references.thisAbility, enemy); if (localEventsListener) { localEventsListener.KillEvent(references.thisAbility, enemy); } } } } else { Debug.LogError("Enemy " + enemy.name + " has no protection class"); } }
// Use this for initialization void Start() { // subscribe to the new enemy hit event GetComponent <HitDetector>().newAllyHitEvent += giveResources; // get a reference to the creator's mana CreationReferences references = GetComponent <CreationReferences>(); if (references) { creator = references.creator; if (creator) { creatorMana = creator.GetComponent <BaseMana>(); creatorProtection = creator.GetComponent <ProtectionClass>(); } } }
// Use this for initialization void Start() { // get a reference to the creator's mana and protection CreationReferences references = GetComponent <CreationReferences>(); if (references) { GameObject creator = references.creator; if (creator) { if (health != 0 || ward != 0) { creatorProtection = creator.GetComponent <ProtectionClass>(); } if (mana != 0) { creatorMana = creator.GetComponent <BaseMana>(); } } } }
// Use this for initialization protected override void Awake() { ability = AbilityIDList.getAbility(AbilityID.thornBurst); base.Awake(); ProtectionClass protectionClass = GetComponent <ProtectionClass>(); if (protectionClass) { GetComponent <ProtectionClass>().detailedDamageEvent += whenHit; } ua = GetComponent <UsingAbility>(); if (ua) { AbilityEventListener listener = GetComponent <AbilityEventListener>(); if (listener) { listener.onKillEvent += OnKill; listener.onHitEvent += OnHit; } } }
public void LoadData() { Filter = FilterItem.InitFilters(); ProtectionClasses = ProtectionClass.FromDatabase(); TaxonFilterItems = Load.FromFile <TaxonFilterItem>("TaxonFilterItems.json"); Taxa = Load.FromFile <Taxon>("Taxa.json").OrderBy(i => i.LocalName).ThenBy(i => i.TaxonName).ToList(); TaxonImages = Load.FromFile <TaxonImage>("TaxonImages.json"); TaxonImageTypes = Load.FromFile <TaxonImageType>("TaxonImageTypes.json"); TaxonProtectionClasses = Load.FromFile <TaxonProtectionClass>("TaxonProtectionClasses.json"); TaxonSynonyms = Load.FromFile <TaxonSynonym>("TaxonSynonyms.json"); foreach (var taxon in Taxa) { taxon.Images = TaxonImages.Where(i => i.TaxonId == taxon.TaxonId).OrderBy(i => i.Index).ToList(); taxon.ImageTypes = TaxonImageTypes.Where(i => i.TaxonId == taxon.TaxonId && i.TaxonTypeId == taxon.TaxonTypeId).ToList(); taxon.TotalCriteria = TaxonFilterItems.Where(i => i.TaxonId == taxon.TaxonId && i.TaxonTypeId == taxon.TaxonTypeId).Count(); } foreach (var fi in TaxonFilterItems) { if (fi.ListSourceJson != null) { foreach (string lsj in fi.ListSourceJson) { if (!TaxonImages.Select(ti => ti.Title).ToList().Contains(lsj.Trim())) { TaxonImages.Add(new TaxonImage { Title = lsj.Trim(), ImageId = Guid.NewGuid().ToString() }); } } } } TaxonOrders = Taxa.Where(i => i.HasDiagnosis).Select(i => new { i.OrderName, i.OrderLocalName }).Distinct().Select(i => new TaxonOrder() { OrderName = i.OrderName, OrderLocalName = i.OrderLocalName }).ToList(); }
public void Apply(GameObject hitObject) { GameObject effect = Instantiate(statusEffect.effectObject, hitObject.transform); StatusDamage statusDamage = effect.GetComponent <StatusDamage>(); TaggedStatsHolder myTaggedStatsHolder = GetComponent <TaggedStatsHolder>(); ProtectionClass protection = hitObject.GetComponent <ProtectionClass>(); if (protection) { if (statusDamage && myTaggedStatsHolder) { TaggedStatsHolder taggedStatsHolder = effect.AddComponent <TaggedStatsHolder>(); taggedStatsHolder.simpleStats.AddRange(myTaggedStatsHolder.simpleStats); taggedStatsHolder.taggedStats.AddRange(myTaggedStatsHolder.taggedStats); // apply DoT damage foreach (TaggedStatsHolder.TaggableStat taggableStat in taggedStatsHolder.taggedStats) { if (taggableStat.tagList.Contains(Tags.AbilityTags.DoT)) { taggableStat.tagList.Remove(Tags.AbilityTags.DoT); } } // build damage stats if necessary foreach (DamageStatsHolder holder in effect.GetComponents <DamageStatsHolder>()) { holder.damageStats = DamageStats.buildDamageStats(holder, taggedStatsHolder); } } // add creation reference CreationReferences myReferences = GetComponent <CreationReferences>(); if (myReferences) { CreationReferences references = effect.AddComponent <CreationReferences>(); references.creator = myReferences.creator; references.thisAbility = myReferences.thisAbility; } // add alignment AlignmentManager myAlignmentManager = GetComponent <AlignmentManager>(); if (myAlignmentManager) { AlignmentManager alignmentManager = effect.AddComponent <AlignmentManager>(); alignmentManager.alignment = myAlignmentManager.alignment; } // apply shock effect if (statusEffect.effectID == 13) { TaggedStatsHolder tsh = GetComponent <TaggedStatsHolder>(); if (tsh) { float shockEffect = tsh.GetStatValue(Tags.Properties.IncreasedShockEffect); BuffParent pb = effect.GetComponent <BuffParent>(); if (shockEffect != 0 && pb) { foreach (TaggedStatsHolder.TaggableStat stat in pb.taggedStats) { stat.addedValue *= (1 + shockEffect); stat.increasedValue *= (1 + shockEffect); } } } } // apply protection.effectControl.AddEffect(effect, effect.GetComponent <StatusEffect>()); } }
public void DecryptFile(string inputFile, string outputFile, WrappedKey wrappedKey, ProtectionClass protectionClass, bool overwrite) { var key = UnwrapKey(wrappedKey, _classKeys, protectionClass); DecryptFileCore(inputFile, outputFile, key, overwrite); }
void initialise() { initialised = true; // make sure there is a parent if (transform.parent == null) { return; } if (parent == null) { parent = transform.parent.gameObject; } if (parent == null) { Debug.LogError("BuffParent component has no parent"); return; } // find the parent's protection class parentProtection = parent.gameObject.GetComponent <ProtectionClass>(); if (parentProtection) { if (ward != 0) { parentProtection.GainWard(ward); } if (wardPercentage != 0 && parent.GetComponent <BaseHealth>()) { parentProtection.GainWard((wardPercentage * parent.GetComponent <BaseHealth>().maxHealth)); } } if (increasedSize != 0) { SizeManager sizeManager = parent.GetComponent <SizeManager>(); if (sizeManager) { sizeManager.increaseSize(increasedSize); } } // find the parent's base health if (lifeRegen != 0) { parentHealth = parent.GetComponent <BaseHealth>(); parentHealth.addedHealthRegenPerSecond += lifeRegen; } // find the parent's base mana if (manaCostDivider != 0) { parentMana = parent.GetComponent <BaseMana>(); parentMana.addedManaCostDivider += manaCostDivider; } // find the parent's demo ward regen if (wardRegen != 0) { parentProtection.wardRegen += wardRegen; } // find the parent's base stats if (speed != 0) { parentBaseStats = parent.GetComponent <BaseStats>(); if (parentBaseStats != null) { parentBaseStats.ChangeStatModifier(Tags.Properties.Movespeed, speed, BaseStats.ModType.ADDED); } } // find the parent's speed manager if (percentageSpeed != 0) { if (!parentBaseStats) { parentBaseStats = parent.GetComponent <BaseStats>(); } parentSpeedManager = parent.GetComponent <SpeedManager>(); if (parentSpeedManager != null && parentBaseStats != null) { parentBaseStats.ChangeStatModifier(Tags.Properties.Movespeed, percentageSpeed, BaseStats.ModType.INCREASED); } } if (reducedStunDuration != 0) { parentStunnedState = parent.gameObject.GetComponent <Stunned>(); if (parentStunnedState != null) { parentStunnedState.baseStunDuration -= reducedStunDuration; } } // apply taggedStats parentBaseStats = parent.GetComponent <BaseStats>(); if (parentBaseStats) { foreach (TaggedStatsHolder.TaggableStat stat in taggedStats) { parentBaseStats.ChangeStatModifier(stat.property, stat.addedValue, BaseStats.ModType.ADDED, stat.tagList); parentBaseStats.ChangeStatModifier(stat.property, stat.increasedValue, BaseStats.ModType.INCREASED, stat.tagList); foreach (float value in stat.moreValues) { parentBaseStats.ChangeStatModifier(stat.property, value, BaseStats.ModType.MORE, stat.tagList); } foreach (float value in stat.quotientValues) { parentBaseStats.ChangeStatModifier(stat.property, value, BaseStats.ModType.QUOTIENT, stat.tagList); } } parentBaseStats.UpdateStats(); } // update protection totals if (parentProtection) { parentProtection.UpdateProtectionTotals(); } // subscribe to a death event to remove the buffs if (GetComponent <SelfDestroyer>()) { GetComponent <SelfDestroyer>().deathEvent += removeBuffs; } }
public static byte[] UnwrapKey(WrappedKey item, IReadOnlyDictionary <ProtectionClass, byte[]> classKeys, ProtectionClass protectionClass) { var kek = classKeys[protectionClass]; return(KeyWrapAlgorithm.UnwrapKey(kek, item.Key)); }