IEnumerator Drop() { bool overlappingDrop = dotsDropping; dotsDropping = true; // Drop dots column by column for (int k = 0; k < boardHeight; k++) { for (int i = 0; i < boardWidth; i++) { BoardSpace curSpace = BoardArray[i][k]; DotController curDot = curSpace.GetCurrentDot(); bool alreadyDropping = curDot.IsDropping; if (curSpace.IsEmpty || curDot.FlaggedToDrop || curDot.IsDropping) { dotsToDrop++; curDot.OnDropComplete += OnDropComplete; curSpace.DropDot(dropTime); } } // offset each row's drop, if its not an overlapping drop call if (!overlappingDrop) { yield return(dropRow); } } }
void MakeInstance() { if (instance == null) { instance = this; } }
private GameObject CreateNewDot(Vector2 anchoredPosition, Color color, float attributeValue, string attribute) { GameObject dot = Instantiate(dotSpriteNew); dot.transform.SetParent(thingsContainer, false); dot.transform.localScale = new Vector2(0.15f, 0.15f); Image image = dot.GetComponent <Image>(); image.color = color; RectTransform rectTransform = dot.GetComponent <RectTransform>(); rectTransform.anchoredPosition = anchoredPosition; rectTransform.anchorMin = new Vector2(0, 0); rectTransform.anchorMax = new Vector2(0, 0); Text dotAttributeValue = dot.transform.Find("AttributeValueHolder").GetComponent <Text>(); dotAttributeValue.text = attributeValue.ToString(); RectTransform rectTransformAtt = dotAttributeValue.GetComponent <RectTransform>(); rectTransformAtt.localScale = new Vector2(5, 5); DotController dotController = dot.GetComponent <DotController>(); dotController.color = color; dotController.attribute = attribute; dot.SetActive(true); return(dot); }
private void DestroyMatchesAt(int column, int row) { if (allDots[column, row].GetComponent <DotController>().isMatched) { //play destroy sound AudioManager.instance.PlayRandomDestroySound(); //destroy match particle GameObject particle = Instantiate(destroyEffect, allDots[column, row].transform.transform.position, Quaternion.identity); Destroy(particle, .5f); //how many dots matched from find matches if (FindMatches.instance.currentMatches.Count >= 4) { CheckToMakeBombs(); } Destroy(allDots[column, row]); currentDot = null; ScoreManager.instance.IncreaseScore(basePieceValue * streakValue); allDots[column, row] = null; //GOLD PRO AMIGO PetController.instance.money += 5; } }
private IEnumerator FillBoardCo() { RefillBoard(); yield return(new WaitForSeconds(refillDelay)); while (MatchesOnBoard()) { streakValue++; DestroyMatches(); yield return(new WaitForSeconds(refillDelay * 1.5f)); } FindMatches.instance.currentMatches.Clear(); currentDot = null; if (IsDeadLocked()) { //test RestartDots(); } yield return(new WaitForSeconds(refillDelay)); currentState = GameState.move; streakValue = 1; }
public void Awake() { On.RoR2.CharacterBody.OnInventoryChanged += (orig, self) => { if (self.inventory.GetItemCount((ItemIndex)ItemLib.ItemLib.GetItemId("Ifrits Distinction")) > 0) { self.AddBuff(BuffIndex.AffixRed); } else if (self.HasBuff(BuffIndex.AffixRed) && self.inventory.currentEquipmentIndex != EquipmentIndex.AffixRed) { self.RemoveBuff(BuffIndex.AffixRed); } }; On.RoR2.GlobalEventManager.OnHitEnemy += (orig, self, damageInfo, victim) => { orig(self, damageInfo, victim); Debug.Log("Test"); int count = damageInfo.attacker.GetComponent <CharacterBody>().inventory.GetItemCount((ItemIndex)ItemLib.ItemLib.GetItemId("Ifrits Distinction")); if (count > 1) { bool flag5 = (damageInfo.damageType & DamageType.PercentIgniteOnHit) != DamageType.Generic || damageInfo.attacker.GetComponent <CharacterBody>().HasBuff(BuffIndex.AffixRed); CharacterBody bleck = victim.GetComponent <CharacterBody>(); for (int i = count - 1; i > 0; i--) { DotController.InflictDot(victim, damageInfo.attacker, flag5 ? DotController.DotIndex.PercentBurn : DotController.DotIndex.Burn, 4f * damageInfo.procCoefficient, 1f); } } }; }
// Spawn a new dot public DotController SpawnDot(List <Waypoint> currentWaypoints) { DotController newDot = dotManager.GetNewDot(); // add drop waypoints to the new dot for (int i = 0; i < currentWaypoints.Count; i++) { newDot.AddWaypoint(currentWaypoints[i]); } for (int i = 0; i < dotsToDrop.Count; i++) { Waypoint waypoint = new Waypoint(dotsToDrop[i].transform.position); newDot.AddWaypoint(waypoint); } // place the spawned dot int dropNum = dotsToDrop.Count + 1; float screenTop = screenUtil.MaxY(); float ySpacing = coordinateSpace.YSpacing(); float xPos = transform.position.x; float yPos = screenTop + (ySpacing * dropNum); newDot.transform.position = new Vector3(xPos, yPos, 0); dotsToDrop.Add(newDot); return(newDot); }
private void GlobalEventManager_OnHitEnemy(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, UnityEngine.GameObject victim) { GameObject attacker = damageInfo.attacker; if (self && attacker) { var attackerBody = attacker.GetComponent <CharacterBody>(); var victimBody = victim.GetComponent <CharacterBody>(); int thalCount = GetCount(attackerBody); if (thalCount > 0) { bool flag = (damageInfo.damageType & DamageType.PoisonOnHit) > DamageType.Generic; if ((thalCount > 0 || flag) && (flag || Util.CheckRoll((procChance + (stackChance * (thalCount - 1)))))) { ProcChainMask procChainMask = damageInfo.procChainMask; procChainMask.AddProc(ProcType.BleedOnHit); var dotInfo = new InflictDotInfo() { attackerObject = attacker, victimObject = victim, dotIndex = poisonDot, duration = duration, damageMultiplier = dmgCoefficient }; DotController.InflictDot(ref dotInfo); } } } orig(self, damageInfo, victim); }
private static void GlobalEventManager_OnHitEnemy(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { if (damageInfo.HasModdedDamageType(OriginalPoisonOnHit)) { DotController.InflictDot(victim, damageInfo.attacker, OriginalPoisonDot, 2f, 1f); } orig(self, damageInfo, victim); }
public void DeselectDot() { if (FirstSelectedDot != null) { FirstSelectedDot.SetSelect(false); FirstSelectedDot = null; } }
private void DotController_AddDot(On.RoR2.DotController.orig_AddDot orig, DotController self, GameObject attackerObject, float duration, DotController.DotIndex dotIndex, float damageMultiplier) { if (dotIndex == DotController.DotIndex.PercentBurn) { //Duration of Burn Percentage duration = 0; } orig(self, attackerObject, duration, dotIndex, damageMultiplier); }
public static void MyCommandName(ConCommandArgs args) { DotController.DotIndex index = (DotController.DotIndex)Array.FindIndex(DotController.dotDefs, (dotDef) => dotDef.associatedBuff == BuffIndex.OnFire); for (int y = 0; y < args.GetArgInt(0); y++) { DotController.InflictDot(args.senderBody.gameObject, args.senderBody.gameObject, index, args.GetArgInt(1), 0.25f); //args.senderBody.AddTimedBuffAuthority(BuffIndex.OnFire, args.GetArgInt(1)); } }
// Find a new valid dot public void SetNewDot() { DotController newDot = FindNextDot(this, new List <Waypoint>()); newDot.IsDropping = true; currentDot = newDot; connectionLines.SetDotType(newDot.GetDotType()); IsEmpty = false; }
// Retrieves a dot from the pool, with a random type public DotController GetNewDot() { GameObject dotObject = dotPool.GetFromPool(); DotController dot = dotObject.GetComponent <DotController>(); DotType dotType = dotTypes[Random.Range(0, dotTypes.Count)]; dot.SetDotType(dotType); return(dot); }
private IEnumerator FindAllMatchesCo() { yield return(new WaitForSeconds(.1f)); for (int i = 0; i < Board.instance.width; i++) { for (int j = 0; j < Board.instance.heigth; j++) { GameObject currentDot = Board.instance.allDots[i, j]; if (currentDot != null) { DotController currentDotDot = currentDot.GetComponent <DotController>(); if (i > 0 && i < Board.instance.width - 1) { GameObject leftDot = Board.instance.allDots[i - 1, j]; GameObject rightDot = Board.instance.allDots[i + 1, j]; if (leftDot != null && rightDot != null) { DotController leftDotDot = leftDot.GetComponent <DotController>(); DotController rightDotDot = rightDot.GetComponent <DotController>(); if (currentDot.CompareTag(leftDot.tag) && currentDot.CompareTag(rightDot.tag)) { currentMatches.Union(IsRowBomb(leftDotDot, currentDotDot, rightDotDot)); currentMatches.Union(IsColumnBomb(leftDotDot, currentDotDot, rightDotDot)); currentMatches.Union(IsAdjacentBomb(leftDotDot, currentDotDot, rightDotDot)); GetNearbyPieces(leftDot, currentDot, rightDot); } } } if (j > 0 && j < Board.instance.heigth - 1) { GameObject upDot = Board.instance.allDots[i, j + 1]; GameObject downDot = Board.instance.allDots[i, j - 1]; if (upDot != null && downDot != null) { DotController upDotDot = upDot.GetComponent <DotController>(); DotController downDotDot = downDot.GetComponent <DotController>(); if (currentDot.CompareTag(upDot.tag) && currentDot.CompareTag(downDot.tag)) { currentMatches.Union(IsColumnBomb(upDotDot, currentDotDot, downDotDot)); currentMatches.Union(IsRowBomb(upDotDot, currentDotDot, downDotDot)); currentMatches.Union(IsAdjacentBomb(upDotDot, currentDotDot, downDotDot)); GetNearbyPieces(upDot, currentDot, downDot); } } } } } } }
private void On_ESDetonate(On.EntityStates.Engi.Mine.Detonate.orig_Explode orig, Detonate self) { if (self.outer.name != "FootMine(Clone)") { orig(self); } else if (NetworkServer.active) { List <TeamComponent> teamMembers = new List <TeamComponent>(); TeamFilter teamFilter = self.GetComponent <TeamFilter>(); float blastRadius = Detonate.blastRadius * 1.2f; float sqrad = blastRadius * blastRadius; bool isFF = FriendlyFireManager.friendlyFireMode != FriendlyFireManager.FriendlyFireMode.Off; GameObject owner = self.projectileController.owner; int icnt = (int)self.GetComponent <ProjectileDamage>().damage; // this is actually the stack number if (isFF || teamFilter.teamIndex != TeamIndex.Monster) { teamMembers.AddRange(TeamComponent.GetTeamMembers(TeamIndex.Monster)); } if (isFF || teamFilter.teamIndex != TeamIndex.Neutral) { teamMembers.AddRange(TeamComponent.GetTeamMembers(TeamIndex.Neutral)); } if (isFF || teamFilter.teamIndex != TeamIndex.Player) { teamMembers.AddRange(TeamComponent.GetTeamMembers(TeamIndex.Player)); } if (owner) { teamMembers.Remove(owner.GetComponent <TeamComponent>()); } foreach (TeamComponent tcpt in teamMembers) { if ((tcpt.transform.position - self.transform.position).sqrMagnitude <= sqrad) { if (tcpt.body && tcpt.body.mainHurtBox && tcpt.body.isActiveAndEnabled) { DotController.InflictDot(tcpt.gameObject, owner, poisonDot, baseTicks + stackTicks * (icnt - 1), baseDmg + stackDmg * (icnt - 1)); } } } if (Detonate.explosionEffectPrefab) { EffectManager.SpawnEffect(Detonate.explosionEffectPrefab, new EffectData { origin = self.transform.position, rotation = self.transform.rotation, scale = blastRadius }, true); } EntityState.Destroy(self.gameObject); } }
public void MarkToBeDestroyed(DotController dot) { if (matrix[dot.x, dot.y].destroyed) { return; } dirtyCol[dot.x] = true; dot.MarkToBeDestroyed(); matches.Add(dot); }
private static void GlobalEventManager_ServerDamageDealt(On.RoR2.GlobalEventManager.orig_ServerDamageDealt orig, DamageReport damageReport) { orig(damageReport); if ((damageReport.attackerBody) && damageReport.dotType == DotController.DotIndex.None && damageReport.attackerBody.HasBuff(_buffIndex)) { damageReport.victimBody.AddTimedBuff(BuffIndex.Blight, 2f); DotController.InflictDot(damageReport.victimBody.gameObject, damageReport.attacker, DotController.DotIndex.Blight, 2f, 1f); } }
public void OnMove(DotController controller, float xWorld, float yWorld) { if (mCurrentChess == null) { return; } mCurrentChess.MoveToPosition(xWorld, yWorld); UpdateValueOnBoard(controller.GetIndex()); ClearDotOnBoard(); }
// Use this for initialization void Start() { controller = GameObject.Find("DotController").GetComponent <DotController> (); text.color = Color.green; camera = Camera.main; size = GameObject.Find("AllFields").GetComponent <LevelGenerator>().square.GetComponent <SpriteRenderer>().size; countOfSquares = GameObject.Find("AllFields").GetComponent <LevelGenerator> ().countOfSqueres; maxX = size.x * countOfSquares; maxY = size.y * countOfSquares; }
private static void On_TreebotFlower2RootPulse(On.EntityStates.Treebot.TreebotFlower.TreebotFlower2Projectile.orig_RootPulse orig, TreebotFlower2Projectile self) { var owner = self.GetFieldValue <GameObject>("owner"); var isBoosted = Scepter.instance.GetCount(owner?.GetComponent <CharacterBody>()) > 0; var origRadius = TreebotFlower2Projectile.radius; if (isBoosted) { TreebotFlower2Projectile.radius *= 2f; } orig(self); TreebotFlower2Projectile.radius = origRadius; if (!isBoosted) { return; } var rb = self.GetFieldValue <List <CharacterBody> >("rootedBodies"); rb.ForEach(cb => { var nbi = Scepter.instance.itemRng.NextElementUniform(new[] { BuffIndex.Bleeding, BuffIndex.ClayGoo, BuffIndex.Cripple, BuffIndex.HealingDisabled, BuffIndex.OnFire, BuffIndex.Weak, BuffIndex.Pulverized, ClassicItemsPlugin.freezeBuff }); if (nbi == ClassicItemsPlugin.freezeBuff) { var ssoh = cb.gameObject.GetComponent <SetStateOnHurt>(); if (ssoh && ssoh.canBeFrozen) { ssoh.SetFrozen(1.5f); } else { return; } } if (nbi == BuffIndex.OnFire) { DotController.InflictDot(cb.gameObject, owner, DotController.DotIndex.Burn, 1.5f, 1f); } if (nbi == BuffIndex.Bleeding) { DotController.InflictDot(cb.gameObject, owner, DotController.DotIndex.Bleed, 1.5f, 1f); } cb.AddTimedBuff(nbi, 1.5f); }); }
private static void ShortenDots(On.RoR2.DotController.orig_AddDot orig, DotController self, GameObject attackerObject, float duration, DotController.DotIndex dotIndex, float damageMultiplier) { var cb = self.GetPropertyValue <CharacterBody>("victimBody"); float newduration = duration; var component = cb.GetComponent <DebuffStatComponent>(); if (component) { newduration *= component.Reduction; } orig(self, attackerObject, newduration, dotIndex, damageMultiplier); }
public static void ApplyDot(this HealthComponent victim, GameObject attacker, DotController.DotIndex dotIndex, float duration = 8f, float damageMultiplier = 1f) { if (NetworkServer.active) { DotController.InflictDot(victim.gameObject, attacker, dotIndex, duration, damageMultiplier); } else { new DotMessage(victim.gameObject, attacker, dotIndex, duration, damageMultiplier) .Send(NetworkDestination.Server); } }
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member private void On_GEMOnHitEnemy(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { orig(self, damageInfo, victim); if (!NetworkServer.active || !victim || !damageInfo.attacker || damageInfo.procCoefficient <= 0f) { return; } var vicb = victim.GetComponent <CharacterBody>(); CharacterBody body = damageInfo.attacker.GetComponent <CharacterBody>(); if (!body || !vicb || !vicb.healthComponent || !vicb.mainHurtBox || vicb.HasBuff(poisonBuff)) { return; } CharacterMaster chrm = body.master; if (!chrm) { return; } int icnt = GetCount(body); if (icnt == 0) { return; } icnt--; float m2Proc = procChance; if (icnt > 0) { m2Proc += stackChance * icnt; } if (m2Proc > capChance) { m2Proc = capChance; } if (!Util.CheckRoll(m2Proc * damageInfo.procCoefficient, chrm)) { return; } DotController.InflictDot(victim, damageInfo.attacker, poisonDot, duration); }
private static void PoisonOnHit_OnHit(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager gem, DamageInfo damageInfo, [NotNull] GameObject victim) { try { if (damageInfo.procCoefficient == 0f || damageInfo.rejected) { return; } if (!NetworkServer.active) { return; } CharacterBody component = damageInfo.attacker.GetComponent <CharacterBody>(); CharacterBody characterBody = victim ? victim.GetComponent <CharacterBody>() : null; if (component) { CharacterMaster master = component.master; if (master) { Inventory inventory = master.inventory; TeamComponent component2 = component.GetComponent <TeamComponent>(); TeamIndex teamIndex = component2 ? component2.teamIndex : TeamIndex.Neutral; Vector3 aimOrigin = component.aimOrigin; int itemCount2 = inventory.GetItemCount(GNCItemSuite.PoisonOnHitItemIndex); int itemCount3 = inventory.GetItemCount(GNCItemSuite.BlightOnHitItemIndex); if ((itemCount2 > 0) && (Util.CheckRoll(5f * (float)itemCount2 * damageInfo.procCoefficient, master))) { ProcChainMask procChainMask2 = damageInfo.procChainMask; procChainMask2.AddProc(ProcType.BleedOnHit); DotController.InflictDot(victim, damageInfo.attacker, DotController.DotIndex.Poison, 10f * damageInfo.procCoefficient, 1f); } if ((itemCount3 > 0) && (Util.CheckRoll(10f * (float)itemCount3 * damageInfo.procCoefficient, master))) { ProcChainMask procChainMask2 = damageInfo.procChainMask; procChainMask2.AddProc(ProcType.BleedOnHit); DotController.InflictDot(victim, damageInfo.attacker, DotController.DotIndex.Blight, 10f * damageInfo.procCoefficient, 1f); } } } } catch { } orig(gem, damageInfo, victim); }
static public void ModdedHitEnemy(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { if (damageInfo.procCoefficient == 0 || !NetworkServer.active || (!(bool)damageInfo.attacker || damageInfo.procCoefficient <= 0)) { return; } CharacterBody Attacker = damageInfo.attacker.GetComponent <CharacterBody>(); CharacterBody characterBody = victim ? victim.GetComponent <CharacterBody>() : null; if (!Attacker) { return; } CharacterMaster master = Attacker.master; if (!master) { return; } damageInfo.procChainMask.LinkToManager(); Inventory inventory = master.inventory; TeamComponent Team = Attacker.GetComponent <TeamComponent>(); TeamIndex attackerTeamIndex = Team ? Team.teamIndex : TeamIndex.Neutral; Vector3 aimOrigin = Attacker.aimOrigin; ModItemManager.OnHitEnemyEffects(self, damageInfo, victim); //SetOnFire . Can't realy do much for this one int DamageType = (uint)(damageInfo.damageType & RoR2.DamageType.IgniteOnHit) > 0U ? 1 : 0; bool CanSetFire = (damageInfo.damageType & RoR2.DamageType.PercentIgniteOnHit) != RoR2.DamageType.Generic || Attacker.HasBuff(BuffIndex.AffixRed); int num2 = CanSetFire ? 1 : 0; if ((DamageType | num2) != 0) { DotController.InflictDot(victim, damageInfo.attacker, CanSetFire ? DotController.DotIndex.PercentBurn : DotController.DotIndex.Burn, 4f * damageInfo.procCoefficient, 1f); } //Apply Ice Elite (Will have to wait for Buff Change for that) if ((Attacker.HasBuff(BuffIndex.AffixWhite) ? 1 : 0) > 0 && (bool)((UnityEngine.Object)characterBody)) { characterBody.AddTimedBuff(BuffIndex.Slow80, 1.5f * damageInfo.procCoefficient); } damageInfo.procChainMask.UnlinkToManager(); }
public void AddBuffAndDot(BuffIndex buff, float duration, int stackCount, RoR2.CharacterBody body) { DotController.DotIndex index = (DotController.DotIndex)Array.FindIndex(DotController.dotDefs, (dotDef) => dotDef.associatedBuff == buff); for (int y = 0; y < stackCount; y++) { if (index != DotController.DotIndex.None) { DotController.InflictDot(body.gameObject, body.gameObject, index, duration, 0.25f); } else { body.AddTimedBuffAuthority(buff, duration); } } }
// Token: 0x06001CD8 RID: 7384 RVA: 0x0007B5C0 File Offset: 0x000797C0 public static void OnCharacterDeath(DamageReport damageReport) { DotController dotController = DotController.FindDotController(damageReport.victim.gameObject); bool victimWasBurning = false; if (dotController) { victimWasBurning = (dotController.HasDotActive(DotController.DotIndex.Burn) | dotController.HasDotActive(DotController.DotIndex.PercentBurn) | dotController.HasDotActive(DotController.DotIndex.Helfire)); } StatManager.deathEvents.Enqueue(new StatManager.DeathEvent { damageReport = damageReport, victimWasBurning = victimWasBurning }); }
// Recursively propogates up adjacent spaces to find a new dot DotController FindNextDot(BoardSpace space, List <Waypoint> waypoints) { AdjacentSpaces adjacent = space.GetAdjacentSpaces(); Waypoint spaceWaypoint = new Waypoint(screenPosition); if (space.IsTopSpace) { BoardSpaceSpawner boardSpaceSpawner = space.GetSpawner(); DotController dot = space.GetCurrentDot(); // Spawn a new dot to drop if (space.IsEmpty || dot.FlaggedToDrop) { waypoints.Add(spaceWaypoint); DotController newDot = boardSpaceSpawner.SpawnDot(waypoints); newDot.FlaggedToDrop = true; return(newDot); } // Current dot is valid waypoints.Add(spaceWaypoint); for (int i = 0; i < waypoints.Count; i++) { dot.AddWaypoint(waypoints[i]); } dot.FlaggedToDrop = true; return(dot); } BoardSpace nextSpace = adjacent.Top; DotController nextDot = nextSpace.GetCurrentDot(); // Propogate up adjacent dots if (nextSpace.IsEmpty || nextDot.FlaggedToDrop) { waypoints.Add(spaceWaypoint); return(FindNextDot(nextSpace, waypoints)); } // Found valid dot waypoints.Add(spaceWaypoint); for (int i = 0; i < waypoints.Count; i++) { nextDot.AddWaypoint(waypoints[i]); } nextDot.FlaggedToDrop = true; return(nextDot); }
public void OnShow(ChessController chess, ArrayList posCanMove) { ClearDotOnBoard(); foreach (int pos in posCanMove) { XY point = (XY)XYValues[pos]; Transform newDot = Instantiate(dot, new Vector3(point.mXWorld, point.mYWorld, -1), Quaternion.identity); DotController controller = newDot.GetComponent <DotController>(); controller.SetIndex(pos); controller.SetOnMoveClickListener(this); mDots.Add(newDot); } mCurrentChess = chess; }