public void ApplyBuff(Chr chrAlly) { //Make sure we are buffing an ally and not ourselves if (chrAlly == this.chrTarget) { return; } //Don't target dead characters if (chrAlly.bDead) { Debug.LogError("Attempting to buff a dead character - shouldn't have been supplied as an active character"); return; } //So we're sure we're buffing a valid character at this point ContSkillEngine.Get().AddExec(new ExecApplySoulChr(chrSource, chrAlly, new SoulChangePower(chrSource, chrAlly, skillSource, nPowerGain, 1) { //Set up the hidden soul effect that's buffing the ally's power bRemoveOnChrSourceDeath = true }) { //Set up the properties of the soul application executable sLabel = chrAlly.sName + " is inspired by " + this.chrSource.sName }); }
public Soul(Soul soulToCopy) { chrSource = soulToCopy.chrSource; skillSource = soulToCopy.skillSource; soulContainer = soulToCopy.soulContainer; sName = string.Copy(soulToCopy.sName); bVisible = soulToCopy.bVisible; bLocked = soulToCopy.bLocked; bRemoveOnChrSourceDeath = soulToCopy.bRemoveOnChrSourceDeath; nMaxStacks = soulToCopy.nMaxStacks; nCurStacks = soulToCopy.nCurStacks; bDuration = soulToCopy.bDuration; nCurDuration = soulToCopy.nCurDuration; if (soulToCopy.pnMaxDuration != null) { pnMaxDuration = new Property <int>(soulToCopy.pnMaxDuration); //Ensure any fixed subscribers to pnMaxDuration.subChanged are properly set up InitSubMaxDuration(); } if (soulToCopy.lstReplacements != null) { lstReplacements = new List <Replacement>(soulToCopy.lstReplacements); } InitTriggers(); }
/// <summary> /// 获取字符串左边所有数值字符串 /// </summary> /// <param name="sourec">需要获取字符串</param> /// <param name="subCount">如果第一个字符不是数值则左侧截取个数</param> /// <returns>数值字符串</returns> public static string GetLeftNumString(string source, int subCount) { string Result = string.Empty; if (string.IsNullOrEmpty(source)) { return(Result); } int Temp; foreach (char Chr in source) { if (int.TryParse(Chr.ToString(), out Temp)) { Result += Chr.ToString(); } else { break; } } if (Result.Length == 0) { if (source.Length < subCount) { Result = source; } else { Result = source.Substring(0, subCount); } } return(Result); }
private void SwapPositions(Position pos1, Position pos2) { if (IsDiffOwnerOfPosition(pos1, pos2)) { Debug.LogError("Can't move to an opponent's position"); return; } Chr chr1 = pos1.chrOnPosition; Chr chr2 = pos2.chrOnPosition; //Update both positions pos1.SetChrOnPosition(chr2); pos2.SetChrOnPosition(chr1); //Update both characters if (chr1 != null) { chr1.SetPosition(pos2); } if (chr2 != null) { chr2.SetPosition(pos1); } }
public void SetChrSource(Chr _chrSource) { chrSource = _chrSource; //Set the GetPower function to fetch the chrSource's current power GetPower = () => chrSource.pnPower.Get(); }
public ExecDealDamage(Chr _chrSource, Chr _chrTarget, Damage _dmg) : base(_chrSource, _chrTarget) { dmg = new Damage(_dmg); dmg.chrSource = _chrSource; dmg.chrTarget = _chrTarget; }
public Mapper0(ReadOnlySpan <byte> prg, Memory <byte> sram, ReadOnlySpan <byte> chr) { Prg = prg.ToArray(); Sram = sram; Chr = chr.IsEmpty ? new byte[0x2000] : Chr.ToArray(); Mirroring = prg.Length == Header.PrgUnitSize; }
//Have a constructor that just accepts a premade Healing instance and copies it public ExecHeal(Chr _chrSource, Chr _chrTarget, Healing _heal) : base(_chrSource, _chrTarget) { heal = new Healing(_heal); heal.chrSource = _chrSource; heal.chrTarget = _chrTarget; }
public SoulDispirited(SoulDispirited other, Chr _chrTarget = null) : base(other, _chrTarget) { arnCostDebuff = new int[Mana.nManaTypes]; System.Array.Copy(other.arnCostDebuff, arnCostDebuff, other.arnCostDebuff.Length); arnodeCostModifier = new LinkedListNode <Property <Mana> .Modifier> [Chr.nEquippedCharacterSkills]; System.Array.Copy(other.arnodeCostModifier, arnodeCostModifier, other.arnodeCostModifier.Length); }
//Find the model, and do any setup to reflect it public void InitModel() { mod = GetComponent <Chr>(); mod.Start(); //TODO:: Consider if we want to set up an observer for this // May not need to since a Chr likely won't exist without some sort of View. mod.subFatigueChange.Subscribe(cbUpdateFatigue); mod.subLifeChange.Subscribe(cbUpdateLife); mod.pnMaxHealth.subChanged.Subscribe(cbUpdateLife); mod.subStatusChange.Subscribe(cbUpdateStatus); mod.pnArmour.subChanged.Subscribe(cbUpdateArmour); mod.pnPower.subChanged.Subscribe(cbUpdatePower); mod.pnDefense.subChanged.Subscribe(cbUpdateDefense); mod.subChannelTimeChange.Subscribe(cbUpdateChannelTime); mod.subDeath.Subscribe(cbUpdateDeath); mod.subPreExecuteSkill.Subscribe(cbStartUsingSkill); mod.subPostExecuteSkill.Subscribe(cbStopUsingSkill); mod.subLifeChange.Subscribe(cbRecoil); mod.subSoulApplied.Subscribe(cbSoulApplied); mod.subStunApplied.Subscribe(cbRecoil); mod.subLifeChange.Subscribe(cbOnInjured); mod.subBecomesActiveForHumans.Subscribe(cbOnBecomesActiveForHumans); mod.subEndsActiveForHumans.Subscribe(cbOnEndsActiveForHumans); mod.subBecomesTargettable.Subscribe(cbOnBecomesTargettable); mod.subEndsTargettable.Subscribe(cbOnEndsTargettable); }
/// <summary> /// 汉字转拼音缩写 /// </summary> /// <param name="str">要转换的汉字字符串</param> /// <returns>拼音缩写</returns> public static String GetPYString(String str) { String TempStr = ""; foreach (char Chr in str) { if ((int)Chr >= 33 && (int)Chr <= 126) { //字母和符号原样保留 TempStr += Chr.ToString(); } else if ((int)Chr == 12288) { //将全角空格转换为半角空格 TempStr += (char)32; } else if ((int)Chr > 65280 && (int)Chr < 65375) { //将全角符号转换为半角符号 TempStr += (char)((int)Chr - 65248); } else { //累加拼音声母 TempStr += PinYinConverter.GetFirst(Chr); //GetPYChar(Chr.ToString()); } } return(TempStr); }
protected virtual void Update() { AniSpeed = new Vector2(AimVelocity.x, AimVelocity.z).magnitude / behaviourSetting.RunSpeed; if (behaviourSetting.HasHand && FixAniParamFlag) { FixAniParamFlag = false; Item item = HoldingItemL ?? HoldingItemR; if (item && item is Weapon) { SetWeaponInfo((Weapon)item); } else { SetWeaponInfo(); } } Chr.Move(AimVelocity * Time.deltaTime); bool onGround = Chr.isGrounded; if (onGround) { CurrentJumpCount = 0; } AimVelocity.y += onGround ? 0f : Physics.gravity.y * 10f * Time.deltaTime; AniOnGround = onGround; }
public SoulSmokeCover(Chr _chrSource, Chr _chrTarget, Skill _skillSource) : base(_chrSource, _chrTarget, _skillSource) { sName = "SmokeCover"; bVisible = true; bDuration = true; bRecoilWhenApplied = false; pnMaxDuration = new Property <int>(4); lstReplacements = new List <Replacement>() { new Replacement() { //The list of replacement effects we'll include ourselves in lstExecReplacements = ExecDealDamage.lstAllFullReplacements, //Note that the parameter type is the generic Executable // - should cast to the proper type if further checking is required shouldReplace = (Executable exec) => { Debug.Assert(typeof(ExecDealDamage) == exec.GetType()); //replace only if the damaged character will be the character this effect is on return(((ExecDealDamage)exec).chrTarget == this.chrTarget); }, //Just replace the executable with a completely new null executable execReplace = (Executable exec) => new ExecNull(exec.chrSource) } }; }
public ExecChangeMana(Chr _chrSource, Player _plyrTarget, Mana.MANATYPE _manaType, int _nAmount = 1) : base(_chrSource, _plyrTarget) { plyrTarget = _plyrTarget; manaType = _manaType; nAmount = _nAmount; }
public static SkillSlot DeserializeSkillSlot(int nSerializedSkill) { Chr chrUsing = Serializer.DeserializeChr(Serializer.GetByte(0, nSerializedSkill)); int iSkillSlot = Serializer.GetByte(1, nSerializedSkill); return(chrUsing.arSkillSlots[iSkillSlot]); }
/// <summary> /// ºº×ÖתƴÒôËõд /// </summary> /// <param name="str">Ҫת»»µÄºº×Ö×Ö·û´®</param> /// <returns>Æ´ÒôËõд</returns> public static String GetPYString(String str) { String TempStr = ""; foreach (char Chr in str) { if ((int)Chr >= 33 && (int)Chr <= 126) { //×ÖĸºÍ·ûºÅÔÑù±£Áô TempStr += Chr.ToString(); } else if ((int)Chr == 12288) { //½«È«½Ç¿Õ¸ñת»»Îª°ë½Ç¿Õ¸ñ TempStr += (char)32; } else if ((int)Chr > 65280 && (int)Chr < 65375) { //½«È«½Ç·ûºÅת»»Îª°ë½Ç·ûºÅ TempStr += (char)((int)Chr - 65248); } else { //ÀÛ¼ÓÆ´ÒôÉùĸ //TempStr += GetPYChar(Chr.ToString()); TempStr += PinYinConverter.GetFirst(Chr); // ÎÄÊéºÍÒ»Ìå»ú³ÌÐòWPF²¿·ÖʹÓÃͬһÖÖ·½·¨ } } return(TempStr); }
/// <summary> /// ºº×ÖתƴÒôËõд /// </summary> /// <param name="str">Ҫת»»µÄºº×Ö×Ö·û´®</param> /// <returns>Æ´ÒôËõд</returns> public static String GetPYString(String str) { String TempStr = ""; foreach (char Chr in str) { if ((int)Chr >= 33 && (int)Chr <= 126) { //×ÖĸºÍ·ûºÅÔÑù±£Áô TempStr += Chr.ToString(); } else if ((int)Chr == 12288) { //½«È«½Ç¿Õ¸ñת»»Îª°ë½Ç¿Õ¸ñ TempStr += (char)32; } else if ((int)Chr > 65280 && (int)Chr < 65375) { //½«È«½Ç·ûºÅת»»Îª°ë½Ç·ûºÅ TempStr += (char)((int)Chr - 65248); } else {//ÀÛ¼ÓÆ´ÒôÉùĸ TempStr += GetPYChar(Chr.ToString()); } } return(TempStr); }
public SkillSadism(Chr _chrOwner) : base(_chrOwner) { sName = "Sadism"; sDisplayName = "Sadism"; typeUsage = new TypeUsagePassive(this); //Physical, Mental, Energy, Blood, Effort manaCost = new ManaCost(new Mana(0, 0, 0, 0, 0)); nCooldownInduced = 0; nFatigue = 0; InitTargets(); soulPassive = new SoulSadism(this.chrOwner, this.chrOwner, this); lstClausesOnEquip = new List <ClauseSkill>() { new ClauseEquip(this) }; lstSkillClauses = new List <ClauseSkillSelection>() { new Clause1(this) }; lstClausesOnUnequip = new List <ClauseSkill>() { new ClauseUnequip(this) }; }
public SkillSlot(Chr _chrOwner, int _iSlot) { chrOwner = _chrOwner; iSlot = _iSlot; nCooldown = 0; }
public void SwitchChrToBench(Chr chr, Position pos) { if (IsDiffOwnerOfPosition(chr.position, pos)) { Debug.LogError("Can't move to an opponent's position"); return; } if (pos.positiontype != Position.POSITIONTYPE.BENCH) { Debug.LogError("Can only select a bench-position to move to when bench-swapping"); return; } if (chr.position.positiontype == Position.POSITIONTYPE.BENCH) { Debug.LogError("Can't swap to the bench when " + chr.sName + " is already on the bench"); return; } Position posStarting = chr.position; SwapPositions(pos, posStarting); //TODO - figure out what bench triggers to put in here // Will probably have to put in similar sub notifications as in the SwitchChr function }
protected override void AttemptFillRandomly() { chrActing = ContTurns.Get().GetNextActingChr(); int nMaxSelectionAttempts = 5; int nCurSelectionAttempt = 0; //We'll attempt a few selections to see if we can find something legal while (nCurSelectionAttempt < nMaxSelectionAttempts) { nCurSelectionAttempt++; //Select a random skill we have that's off cooldown skillslotSelected = chrActing.arSkillSlots[Random.Range(0, Chr.nEquippedCharacterSkills)]; lstSelections = new List <object>(); //If the skill can't be activated for whatever reason (like being a passive), then skip to the next attempt if (skillslotSelected.chrOwner.curStateReadiness.CanSelectSkill(skillslotSelected.skill) == false) { continue; } //If the skill is on cooldown, then we'll skip to the next attempt if (skillslotSelected.IsOffCooldown() == false) { continue; } //For each target we have to fill out, get a random selectable for its targetting type bool bFailedSelection = false; for (int i = 0; i < skillslotSelected.skill.lstTargets.Count; i++) { //Debug.LogFormat("Skill {0} is asking for selections for its {1}th target, {2}", skillSelected, i, skillSelected.lstTargets[i]); if (skillSelected.lstTargets[i].HasAValidSelectable(this) == false) { bFailedSelection = true; break; } //If there's at least something selectable, then pick one of them randomly lstSelections.Add(skillSelected.lstTargets[i].GetRandomValidSelectable(this)); } if (bFailedSelection) { //If we failed finding a selection for some skill, then continue on in the loop to find a different skill selection //Before we move on to the next selection attempt, clear out any reserved mana amounts chrActing.plyrOwner.manapool.ResetReservedMana(); continue; } //If we reached this far without failing a selection, then we should have a fully filled out random selection so we can return Debug.AssertFormat(CanLegallyExecute(), "{0} is an invalid random selection", ToString()); return; } //If we tried many times and couldn't get a valid selection, then we'll just reset the default input ResetToDefaultInput(); }
public static SkillSlot UnserializeSkillSlot(int nSerialized) { int iSkillSlot = nSerialized & (15); //select the first 4 bits Chr chr = TarChr.UnserializeChr(nSerialized >> 4); //chop off the last 4 bits return(chr.arSkillSlots[iSkillSlot]); }
public Position posOriginallyAppliedOn; //A saved reference to the position the character was on when it was originally applied public SoulChr(Chr _chrSource, Chr _chrTarget, Skill _skillSource) : base(_chrSource, _skillSource) { chrTarget = _chrTarget; if (chrTarget != null) { posOriginallyAppliedOn = chrTarget.position; } }
public void SetChrOnPosition(Chr _chrOnPosition) { if (chrOnPosition == _chrOnPosition) { return; } chrOnPosition = _chrOnPosition; }
public static async Task Damage(int Value, Chr Chr) { Chr.HPC -= Value; if (Chr.HPC < 0) { Chr.HPC = Chr.HPM; } await ManageCharacter.UpdateAsync(Chr); }
public override void ClauseEffect(InputSkillSelection selections) { Chr chrSelected = (Chr)selections.lstSelections[1]; ContSkillEngine.PushSingleExecutable(new ExecHeal(skill.chrOwner, chrSelected, healing) { sLabel = "Drink my life-juice" }); }
public override void ClauseEffect(InputSkillSelection selections) { Chr chrSelected = (Chr)selections.lstSelections[1]; //TODO - maybe add some sort of additional function that can be called exactly when the executable resolves to trigger additional effects // e.g., here it could be a structure called Tracking where you call Tracking.BeforeEffect() to track the gamestate before the executable // evaluates (this can store information, and then you call Tracking.AfterEffect() to ContSkillEngine.PushSingleExecutable(new ExecMoveChar(skill.chrOwner, chrSelected, (chrTarget) => ContPositions.Get().GetBehindPosition(chrTarget.position))); }
public SoulImpaled(Chr _chrSource, Chr _chrTarget, Skill _skillSource) : base(_chrSource, _chrTarget, _skillSource) { sName = "Impaled"; nMaxLifeReduction = 10; bVisible = false; bDuration = false; }
public override void ClauseEffect(InputSkillSelection selections) { Chr chrSelected = (Chr)selections.lstSelections[1]; ContSkillEngine.PushSingleExecutable(new ExecDealDamage(skill.chrOwner, chrSelected, dmg) { sLabel = "Gimme yer life-juice" }); }
public static async Task Heal(int Value, Chr Chr) { Chr.HPC += Value; if (Chr.HPC > Chr.HPM) { Chr.HPC = Chr.HPM; } await ManageCharacter.UpdateAsync(Chr); }