override public void AfterAttack(GridEntity attacker, GridEntity target) { if (SkillUtils.Gamble(SkillUtils.GambleOdds.COIN)) { target.baseFearValue = target.fearThreshold; } }
public static void SaveString2() { TextAsset test = Resources.Load <TextAsset>("code/Skill001.lua"); XLua.LuaEnv luaenv = new XLua.LuaEnv(); //luaenv.DoString("CS.UnityEngine.Debug.Log('hello world')"); luaenv.DoString(test.text); luaenv.Dispose(); Debug.Log(test); return; CustomSkill skill = SkillUtils.MakeCustomSkill("001"); skill.id = 001; skill.Trigger(CustomSkill.TriggerType.fight); return; FormulaUtils.GetTowerExtraAttributes(false); return; for (int i = 0; i < 10; i++) { Debug.Log(UnityEngine.Random.Range(0, 0.5f)); } return; //PlayerSQLPrefs.yzTowerLevel = 10; //PlayerSQLPrefs.yzTowerABSLevel = 10; PlayerOtherItem.ReduceItem(GameInstance.GameDatabase.otherItem[0].Id, 10); }
public static void RecordSpell(TrinityPower power) { if (_history.Count >= SpellHistorySize) { _history.RemoveAt(0); } var skill = SkillUtils.ById(power.SNOPower); if (skill.IsAttackSpender) { _lastSpenderCast = DateTime.UtcNow; } if (skill.IsGeneratorOrPrimary) { _lastGeneratorCast = DateTime.UtcNow; } _history.Add(new SpellHistoryItem { Power = power, UseTime = DateTime.UtcNow, MyPosition = Trinity.Player.Position, TargetPosition = power.TargetPosition }); Logger.LogVerbose(LogCategory.Targetting, "Recorded {0}", power); CacheData.AbilityLastUsed[power.SNOPower] = DateTime.UtcNow; Trinity.LastPowerUsed = power.SNOPower; }
override public void BeforeAttack(GridEntity attacker, GridEntity target) { if (target.maxMoves == 0 || SkillUtils.Gamble(SkillUtils.GambleOdds.D4)) { attacker.damageMult = 3; } }
void BuffLogic(int deltaTime, PlayerComponent playerComp) { for (int i = 0; i < playerComp.buffList.Count; i++) { BuffInfo bi = playerComp.buffList[i]; bi.buffTime += deltaTime; if (bi.BuffData.m_DamageNumber > 0) { bi.hitTime -= deltaTime; if (bi.hitTime < 0) { bi.hitTime = (int)(bi.BuffData.m_BuffEffectSpace * 1000); //伤害 if (playerComp.Entity.GetExistComp <LifeComponent>()) { LifeComponent lc = playerComp.Entity.GetComp <LifeComponent>(); SkillUtils.Damage(m_world, m_world.GetEntity(bi.creater), playerComp.Entity, bi.BuffData.m_DamageNumber); m_world.eventSystem.DispatchEvent(GameUtils.c_HitBuff, playerComp.Entity, bi); } } } if (bi.buffTime > bi.BuffData.m_BuffTime * 1000) { m_world.eventSystem.DispatchEvent(GameUtils.c_removeBuff, playerComp.Entity, bi); playerComp.buffList.RemoveAt(i); i--; } } }
public static int CalledShotModifier(this AbstractActor actor) { int mod = 0; // Calculate the pilot mod, if any if (actor.GetPilot() != null) { Pilot pilot = actor.GetPilot(); string pilotKey = pilot.CacheKey(); bool hasPilot = ModState.PilotCalledShotModifiers.TryGetValue(pilot.CacheKey(), out mod); if (!hasPilot) { // Calculate the modifiers for the pilot Mod.Log.Info?.Write($" Calculating calledShotModifier for actor: {actor.DistinctId()}"); int baseMod = Mod.Config.Combat.CalledShot.BaseModifier; int tacticsMod = Mod.Config.Combat.CalledShot.EnableTacticsModifier ? (-1 * SkillUtils.GetTacticsModifier(pilot)) : 0; int tagsCSMod = SkillUtils.GetTagsModifier(pilot, Mod.Config.Combat.CalledShot.PilotTags); // Calculate the actor mod, if any int actorMod = actor.StatCollection.GetValue <int>(ModStats.CalledShot_AttackMod); int calledShotMod = baseMod + tacticsMod + tagsCSMod + actorMod; Mod.Log.Info?.Write($" -- calledShotMod: {calledShotMod} = defaultMod: {baseMod} + tacticsMod: {tacticsMod} + tagsCSMod: {tagsCSMod} + actorMod: {actorMod}"); ModState.PilotCalledShotModifiers[pilotKey] = calledShotMod; } else { Mod.Log.Debug?.Write($"CalledShotModifier: {mod} for actor: {actor.DistinctId()}"); } } return(mod); }
List <EntityBase> GetSkillDamageList(EntityBase entity, SkillDataGenerate skillData) { CampComponent acc = entity.GetComp <CampComponent>(); SkillStatusComponent ssc = entity.GetComp <SkillStatusComponent>(); List <EntityBase> result = new List <EntityBase>(); List <EntityBase> list = GetEntityList(new string[] { "CollisionComponent", "LifeComponent", "CampComponent" }); SkillUtils.UpdateArea(skillAreaCache, skillData.m_EffectArea, ssc.skillDir.ToVector(), entity); Debug.DrawRay(skillAreaCache.position, skillAreaCache.direction, Color.red, 10); for (int i = 0; i < list.Count; i++) { CollisionComponent bcc = list[i].GetComp <CollisionComponent>(); CampComponent bcampc = list[i].GetComp <CampComponent>(); LifeComponent lc = list[i].GetComp <LifeComponent>(); //Debug.Log("bcampc.creater " + bcampc.creater + " AreaCollideSucceed -->" + skillAreaCache.AreaCollideSucceed(bcc.area)); if (acc.creater != bcampc.creater && skillAreaCache.AreaCollideSucceed(bcc.area) && lc.Life > 0) { result.Add(list[i]); } } return(result); }
private void UpdateSkills(bool reset = false) { // We may have loaded settings for all skills from any class. // Active skill is just the subset currently in use by the hero. // But we still need to persist settings for all skills used to-date. // Also need to populate with reference skill info for the pretty UI Icons etc. if (!Player.IsInGame && !ModuleManager.IsEnabled || !ZetaDia.IsInGame) { return; } var activeSettings = SkillUtils.Active.Select(s => new SkillSettings(s)).ToList(); if (Skills == null || !Skills.Any() || reset) { Skills = new List <SkillSettings>(activeSettings); } else { Skills.ForEach(s => s.SetReferenceSkill(SkillUtils.GetSkillByPower(s.SNOPower))); Skills.AddRange(activeSettings.Where(b => Skills.All(a => a.SNOPower != b.SNOPower))); } var availableSkills = Skills.Where(s => Core.Hotbar.ActivePowers.Any(p => s.SNOPower == p)).OrderBy(s => s.Order); ActiveSkills = new FullyObservableCollection <SkillSettings>(availableSkills); }
public override void FixedUpdate(int deltaTime) { List <EntityBase> list = GetEntityList(); for (int i = 0; i < list.Count; i++) { CommandComponent cc = (CommandComponent)list[i].GetComp("CommandComponent"); SkillStatusComponent ssc = (SkillStatusComponent)list[i].GetComp("SkillStatusComponent"); PlayerComponent pc = (PlayerComponent)list[i].GetComp("PlayerComponent"); MoveComponent mc = (MoveComponent)list[i].GetComp("MoveComponent"); LifeComponent lc = (LifeComponent)list[i].GetComp("LifeComponent"); //CD for (int j = 0; j < ssc.m_skillList.Count; j++) { ssc.m_CDList[j] -= deltaTime; } if (ssc.skillDirCache.ToVector() != Vector3.zero && cc.isFire && !pc.GetIsDizziness() && lc.Life > 0 && cc.skillDir.ToVector() == Vector3.zero ) { string skillID = SkillUtils.GetSkillName(cc); SkillData data = ssc.GetSkillData(skillID); if (ssc.GetSkillCDFinsih(skillID)) { //Debug.Log("FIRE!!! --> " + skillID); ssc.m_skillTime = 0; ssc.m_skillStstus = SkillStatusEnum.Before; ssc.m_isTriggerSkill = false; ssc.m_currentSkillData = data; ssc.m_currentSkillData.UpdateInfo(); ssc.SetSkillCD(skillID, data.CDSpace); ssc.skillDir = ssc.skillDirCache.DeepCopy(); AreaDataGenerate areaData = DataGenerateManager <AreaDataGenerate> .GetData(ssc.m_currentSkillData.SkillInfo.m_EffectArea); float distance = ssc.skillDir.ToVector().magnitude; distance = areaData.m_SkewDistance + Mathf.Clamp(distance, 0, areaData.m_distance); Vector3 aimPos = mc.pos.ToVector() + ssc.skillDir.ToVector().normalized *distance; if (areaData.m_Shape != AreaType.Rectangle) { ssc.skillPos.FromVector(aimPos); } else { ssc.skillPos.FromVector(mc.pos.ToVector() + ssc.skillDir.ToVector().normalized *(areaData.m_SkewDistance - areaData.m_Length / 2)); } } } ssc.skillDirCache = cc.skillDir.DeepCopy(); } }
private void InventoryChanged(User obj) { Inventory inventory = GetComponent <PublicStorageComponent>().Storage; User owner = OwnerUser; User creator = Creator; if (owner == null && creator == null) { return; } if (owner == null) { owner = creator; } if (creator == null) { creator = owner; } if (!SkillUtils.UserHasSkill(owner, RequiredSkill, RequiredLevel) && (!SkillUtils.UserHasSkill(creator, RequiredSkill, RequiredLevel))) { if ((inventory.TotalNumberOfItems(typeof(RuinedCarcassItem)) == 0) && (!inventory.IsEmpty)) { InventoryChangeSet changes = new InventoryChangeSet(inventory); changes.Clear(); changes.AddItem <RuinedCarcassItem>(); Result result = changes.TryApply(); } } }
public void LoadSkills(string filename, Class c) { SkillConfigParser sp; Dispatcher.Invoke(() => { if (!File.Exists("resources/config/skills/" + filename)) { SkillUtils.BuildDefaultSkillConfig(filename, c); } try { sp = new SkillConfigParser(filename, c); } catch (Exception) { var res = TccMessageBox.Show("TCC", $"There was an error while reading {filename}. Manually correct the error and press Ok to try again, else press Cancel to build a default config file.", MessageBoxButton.OKCancel); if (res == MessageBoxResult.Cancel) { File.Delete("resources/config/skills/" + filename); } LoadSkills(filename, c); return; } foreach (var sk in sp.Main) { MainSkills.Add(sk); } foreach (var sk in sp.Secondary) { SecondarySkills.Add(sk); } foreach (var sk in sp.Hidden) { HiddenSkills.Add(sk.Skill); } Dispatcher.Invoke(() => { SkillChoiceList.Clear(); foreach (var skill in SkillsDatabase.SkillsForClass) { SkillChoiceList.Add(skill); } SkillsView = Utils.InitLiveView(null, SkillChoiceList, new string[] { }, new SortDescription[] { }); }); NPC(nameof(SkillsView)); NPC(nameof(MainSkills)); NPC(nameof(SecondarySkills)); SkillsLoaded?.Invoke(); }); }
public override IEnumerator DoSkillLogic() { yield return(MoveSkillOB(() => { CustomBuff buff = SkillUtils.MakeCustomBuff("YanShiBaoBuff"); selfOnly.ActionTarget.ApplyCustomBuff(buff); AttackTarget(new SkillAttackDamage(20, 0.5f, 0)); })); }
public override IEnumerator ApplyBuffLogic() { CustomBuff buff001 = SkillUtils.MakeCustomBuff("Buff001"); buff001.SetGiver(selfOnly); GetSelf().ApplyCustomBuff(buff001); Debug.Log("执行了 添加自定义buff 001"); yield return(null); }
/// <summary> /// Get Util Instance /// </summary> /// <returns>class Instance</returns> public static SkillUtils GetInstance() { if (_instance == null) { lock (oo) { _instance = new SkillUtils(); } } return(_instance); }
public override IEnumerator DoSkillLogic() { yield return(MoveToTarget()); CustomBuff buff = SkillUtils.MakeCustomBuff("MuBiaoJiZhongBuff"); selfOnly.ActionTarget.ApplyCustomBuff(buff); yield return(MoveToSelfPos()); }
private void RefreshHotbar() { using (new PerformanceLogger("RefreshHotbar")) { var cPlayer = ZetaDia.CPlayer; LastUpdated = DateTime.UtcNow; PassiveSkills = new HashSet <SNOPower>(cPlayer.PassiveSkills); for (int i = 0; i <= 5; i++) { var diaActiveSkill = cPlayer.GetActiveSkillByIndex(i, ZetaDia.Me.SkillOverrideActive); if (diaActiveSkill == null || diaActiveSkill.Power == SNOPower.None) { continue; } var power = diaActiveSkill.Power; var runeIndex = diaActiveSkill.RuneIndex; var hotbarskill = new HotbarSkill { Power = diaActiveSkill.Power, Slot = (HotbarSlot)i, RuneIndex = runeIndex, HasRuneEquipped = diaActiveSkill.HasRuneEquipped, Skill = SkillUtils.ById(power), //Charges = ZetaDia.Me.CommonData.GetAttribute<int>(((int)diaActiveSkill.Power << 12) + ((int)ActorAttributeType.SkillCharges & 0xFFF)), }; ActivePowers.Add(power); ActiveSkills.Add(hotbarskill); _skillBySNOPower.Add(power, hotbarskill); _skillBySlot.Add((HotbarSlot)i, hotbarskill); if (!DataDictionary.LastUseAbilityTimeDefaults.ContainsKey(power)) { DataDictionary.LastUseAbilityTimeDefaults.Add(power, DateTime.MinValue); } if (!AbilityLastUsed.ContainsKey(power)) { AbilityLastUsed.Add(power, DateTime.MinValue); } } Logger.Log(TrinityLogLevel.Debug, LogCategory.CacheManagement, "Refreshed Hotbar: ActiveSkills={0} PassiveSkills={1}", ActiveSkills.Count, PassiveSkills.Count); } }
public void LoadSkills(Class c) { if (c == Class.None) { return; } var filename = TccUtils.ClassEnumToString(c).ToLower() + "-skills.xml"; SkillConfigParser sp; //Dispatcher.Invoke(() => //{ if (!File.Exists(Path.Combine(App.ResourcesPath, "config/skills", filename))) { SkillUtils.BuildDefaultSkillConfig(filename, c); } try { sp = new SkillConfigParser(filename, c); } catch (Exception) { var res = TccMessageBox.Show("TCC", $"There was an error while reading {filename}. Manually correct the error and press Ok to try again, else press Cancel to build a default config file.", MessageBoxButton.OKCancel, MessageBoxImage.Warning); if (res == MessageBoxResult.Cancel) { File.Delete(Path.Combine(App.ResourcesPath, "config/skills/", filename)); } LoadSkills(c); return; } foreach (var sk in sp.Main) { MainSkills.Add(sk); } foreach (var sk in sp.Secondary) { SecondarySkills.Add(sk); } foreach (var sk in sp.Hidden) { HiddenSkills.Add(sk); } Dispatcher.Invoke(() => SkillsView = CollectionViewUtils.InitLiveView(null, SkillsDatabase.SkillsForClass, new string[] { }, new SortDescription[] { })); ((ICollectionView)SkillsView).CollectionChanged += GcStahp; N(nameof(SkillsView)); N(nameof(MainSkills)); N(nameof(SecondarySkills)); SkillsLoaded?.Invoke(); //}); }
public bool CanCast(SNOPower power) { if (GameData.AlwaysCanCastPowers.Contains(power)) { return(true); } var skill = SkillUtils.GetSkillByPower(power); return(skill != null && skill.CanCast()); }
void Recover(EntityBase skiller, EntityBase recover, SkillDataGenerate skillData) { int revoverNumber = RecoverValueFormula(skillData, skiller, recover); if (revoverNumber == 0) { return; } SkillUtils.Recover(m_world, skiller, recover, revoverNumber); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
}// public override IEnumerator ApplyBuffLogic() { List <BaseCharacterEntity> list = GetSelfFriends(); for (int i = 0; i < list.Count; i++) { CustomBuff buff = SkillUtils.MakeCustomBuff("ShengMingXuYuanBuff"); (list[i] as CharacterEntity).ApplyCustomBuff(buff); } yield return(null); }
public override IEnumerator DoSkillLogic() { yield return(MoveSkillOB(() => { List <BaseCharacterEntity> selfList = GetSelfFriends(); for (int i = 0; i < selfList.Count; i++) { CustomBuff buff = SkillUtils.MakeCustomBuff("JuShiHuDunBuff"); (selfList[i] as CharacterEntity).ApplyCustomBuff(buff); } })); }
public void InitComponent() { _instance = this; anim = GetComponent <Animator>(); _skillUtils = SkillUtils.GetInstance(); animatorInfo = anim.GetCurrentAnimatorStateInfo(0); animatorInfoAtk = anim.GetCurrentAnimatorStateInfo(1); characterController = GetComponent <CharacterController>(); _swordLight = transform.Find("katanaPos/Slash10").GetComponent <ParticleSystem>(); _swordLight.Stop(); magicFactory = transform.Find("MagicFactory").gameObject; FrontGroundPos = transform.Find("FrontGroundPos").gameObject; }
public override IEnumerator DoSkillLogic() { yield return(MoveToTarget()); CustomBuff buff = SkillUtils.MakeCustomBuff("TieBiTongQiangBuff"); List <BaseCharacterEntity> enemys = GetRandomEnemy(9); for (int i = 0; i < enemys.Count; i++) { (enemys[i] as CharacterEntity).ApplyCustomBuff(buff); } yield return(MoveToSelfPos()); }
//战斗中使用的,不至于共用 public List <CustomSkill> GetBattleCustomSkills() { string[] cskills = customSkill.Split(';'); List <CustomSkill> customs = new List <CustomSkill>(); for (int i = 0; i < cskills.Length; i++) { if (!string.IsNullOrEmpty(cskills[i])) { customs.Add(SkillUtils.MakeCustomSkill(cskills[i])); } } customSkills = customs; return(customs); }
public Dictionary <string, CustomSkill> GetCloneCustomSkills() { Dictionary <string, CustomSkill> cloneskill = new Dictionary <string, CustomSkill>(); cloneskill.Add(Const.NormalAttack, SkillUtils.MakeCustomSkill("NormalAttack")); string[] skillId = customSkill.Split(','); for (int i = 0; i < skillId.Length; i++) { if (!string.IsNullOrEmpty(skillId[i])) { cloneskill.Add(skillId[i], SkillUtils.MakeCustomSkill(skillId[i])); } } return(cloneskill); }
public override bool IsAuthorized(User user) { if ((user == null) || (reqskilltype == null)) { return(base.IsAuthorized(user)); } if (base.IsAuthorized(user) && SkillUtils.UserHasSkill(user, reqskilltype, reqskilllevel)) { return(true); } else { return(false); } }
public void UpdateDisplay(AllyInfo selectedAlly) { var threadDamageBonus = selectedAlly.capacity.Where(thread => thread.GetComponent <Ethread>().effectName == "RedThread").Count(); var threadMoveBonus = selectedAlly.capacity.Where(thread => thread.GetComponent <Ethread>().effectName == "BlueThread").Count(); nameText.text = selectedAlly.entity.entityName; subnameText.text = selectedAlly.entity.entitySubname; SetChips(damageChips, selectedAlly.entity.damage + threadDamageBonus); SetChips(moveRangeChips, selectedAlly.entity.maxMoves + threadMoveBonus); SetChips(atkRangeChips, selectedAlly.entity.range); var skills = SkillUtils.PopulateSkills(selectedAlly.entity.skillNames, new List <int> { 1, 1, 1 }); skillNameTexts = skillElements.Select(element => { return(element.Find("SkillName").GetComponent <Text>()); }).ToList(); skillDescTexts = skillElements.Select(element => { return(element.Find("SkillDesc").GetComponent <Text>()); }).ToList(); skills.ForEach(skill => { var skillNameText = skillNameTexts[0]; skillNameTexts.Remove(skillNameText); skillNameText.text = skill.name ?? ""; var skillDescText = skillDescTexts[0]; skillDescTexts.Remove(skillDescText); skillDescText.text = skill.desc ?? ""; }); var enablePrimarySkillText = selectedAlly.capacity.Any(thread => thread.GetComponent <Ethread>().effectName == "PurpleThread"); var enableSecondarySkillText = selectedAlly.capacity.Any(thread => thread.GetComponent <Ethread>().effectName == "YellowThread"); var enableTertiarySkillText = selectedAlly.capacity.Any(thread => thread.GetComponent <Ethread>().effectName == "PinkThread"); ToggleSkillText(skillElements[0], enablePrimarySkillText); ToggleSkillText(skillElements[1], enableSecondarySkillText); ToggleSkillText(skillElements[2], enableTertiarySkillText); // resets any skill section that was previously populated, that the newly selected ally does not have // i.e swapping from ally with 3 skills to one with 2 will empty the third slot even though skillNameTexts.ForEach(text => text.text = ""); skillDescTexts.ForEach(text => text.text = ""); }
public void OnEnabled() { if (IsEnabled || !Application.Current.CheckAccess()) { return; } Core.Init(); TrinitySettings.InitializeSettings(); SkillUtils.UpdateActiveSkills(); TabUi.InstallTab(); SetupDemonBuddy(); UILoader.PreLoadWindowContent(); ModuleManager.Enable(); Core.Logger.Log($"is now ENABLED: {Description} - now in action!"); IsEnabled = true; }
public void LegacyGetModifier_Base() { FactionValue factionValue = new FactionValue(); factionValue.Name = "1"; HumanDescriptionDef humanDescDef = new HumanDescriptionDef("-1", "Test", "FNAME", "LNAME", "CSIGN", Gender.Male, factionValue, 1, "foo", ""); Traverse.Create(humanDescDef).Field("factionValue").SetValue(factionValue); Traverse.Create(humanDescDef).Field("factionID").SetValue("1"); // gun, pilot, guts, tactics PilotDef pilotDefHigh = new PilotDef(humanDescDef, 10, 9, 8, 7, 0, 3, false, 0, "voice", new List <string>() { }, AIPersonality.Undefined, 0, 0, 0); Pilot pilotHigh = new Pilot(pilotDefHigh, "-1", false); Assert.AreEqual(5, SkillUtils.GetGunneryModifier(pilotHigh)); Assert.AreEqual(4, SkillUtils.GetPilotingModifier(pilotHigh)); Assert.AreEqual(4, SkillUtils.GetGutsModifier(pilotHigh)); Assert.AreEqual(3, SkillUtils.GetTacticsModifier(pilotHigh)); PilotDef pilotDefMed = new PilotDef(humanDescDef, 7, 6, 5, 4, 0, 3, false, 0, "voice", new List <string>() { }, AIPersonality.Undefined, 0, 0, 0); Pilot pilotMed = new Pilot(pilotDefMed, "-1", false); Assert.AreEqual(3, SkillUtils.GetGunneryModifier(pilotMed)); Assert.AreEqual(3, SkillUtils.GetPilotingModifier(pilotMed)); Assert.AreEqual(2, SkillUtils.GetGutsModifier(pilotMed)); Assert.AreEqual(2, SkillUtils.GetTacticsModifier(pilotMed)); PilotDef pilotDefLog = new PilotDef(humanDescDef, 4, 3, 2, 1, 0, 3, false, 0, "voice", new List <string>() { }, AIPersonality.Undefined, 0, 0, 0); Pilot pilotLow = new Pilot(pilotDefLog, "-1", false); Assert.AreEqual(2, SkillUtils.GetGunneryModifier(pilotLow)); Assert.AreEqual(1, SkillUtils.GetPilotingModifier(pilotLow)); Assert.AreEqual(1, SkillUtils.GetGutsModifier(pilotLow)); Assert.AreEqual(0, SkillUtils.GetTacticsModifier(pilotLow)); }