private void MoveOverride(List <HexCell> moveCells) { // bool isLost = UnityEngine.Random.Range(0, 2) == 0; bool isLost = NKMRandom.Get(Name, 0, 2) == 0; if (!isLost) { ParentCharacter.DefaultBasicMove(moveCells); } else { Active.RemoveMoveCells(); int movementPoints = ParentCharacter.Speed.Value; Active.MoveCells.Add(ParentCharacter.ParentCell); HexCell lastCell = ParentCharacter.ParentCell; List <HexCell> moveTargets = ParentCharacter.GetBasicMoveCells(); while (movementPoints-- > 0 || !lastCell.IsFreeToStand) { // List<HexCell> neighborMoveCells = lastCell.GetNeighbors(1, // SearchFlags.StopAtEnemyCharacters | SearchFlags.StopAtFriendlyCharacters | SearchFlags.StopAtWalls); List <HexCell> neighborMoveCells = lastCell.GetNeighbors(1).Intersect(moveTargets).ToList(); // int r = UnityEngine.Random.Range(0, neighborMoveCells.Count); // lastCell = neighborMoveCells[r]; lastCell = neighborMoveCells.GetRandom(); Active.AddMoveCell(lastCell); } ParentCharacter.DefaultBasicMove(Active.MoveCells); Console.Log($"{ParentCharacter.FormattedFirstName()}: Cholera, znowu się zgubili?"); // int rand = UnityEngine.Random.Range(1, 4); int soundID = NKMRandom.Get($"{Name} - ID", 1, 4); Active.PlayAudio("op wtf " + soundID); } }
public override void Awake() { ParentCharacter.BeforeBeingBasicAttacked += (attackingCharacter, damage) => { if (!IsEnabled) { return; } MessageLogger.Log(string.Format("{0} blokuje atak {1}!", ParentCharacter.FormattedFirstName(), attackingCharacter.FormattedFirstName())); _attacksToBlock--; _currentBonusAttack += AbilityBonusAttackGain; if (_attacksToBlock == 0) { Disable(); } }; ParentCharacter.BeforeAttack += (character, damage) => damage.Value += _currentBonusAttack; }
public SwordDance() : base(AbilityType.Ultimatum, "Sword Dance", 4) { OnAwake += () => { Validator.ToCheck.Add(() => !IsEnabled); ParentCharacter.BeforeBeingBasicAttacked += (attackingCharacter, damage) => { if (!IsEnabled) { return; } Console.Log( $"{ParentCharacter.FormattedFirstName()} blokuje atak {attackingCharacter.FormattedFirstName()}!"); _attacksToBlock--; damage.Value = 0; _currentBonusAttack += AbilityBonusAttackGain; if (_attacksToBlock == 0) { Disable(); } }; ParentCharacter.BeforeAttack += (character, damage) => damage.Value += _currentBonusAttack; Active.Phase.PhaseFinished += () => { if (!IsEnabled) { return; } _phasesRemain--; if (_phasesRemain == 0) { Disable(); } }; }; }
private void MoveOverride(List <HexCell> moveCells) { if (UnityEngine.Random.Range(0, 2) == 0) { ParentCharacter.DefaultBasicMove(moveCells); } else { Active.RemoveMoveCells(); var movementPoints = ParentCharacter.Speed.Value; Active.MoveCells.Add(ParentCharacter.ParentCell); HexCell lastCell = ParentCharacter.ParentCell; while (movementPoints-- != 0) { List <HexCell> neighborMoveCells = lastCell.GetNeighbors(1, true, true); neighborMoveCells.RemoveAll(cell => cell.CharacterOnCell != null); //we don't want to allow stepping into our characters! var r = UnityEngine.Random.Range(0, neighborMoveCells.Count); lastCell = neighborMoveCells[r]; Active.AddMoveCell(lastCell); } ParentCharacter.DefaultBasicMove(Active.MoveCells); MessageLogger.Log($"{ParentCharacter.FormattedFirstName()}: Cholera, znowu się zgubili?"); } }