protected override void Activate(CharacterBase character) { character.Health += HEALTH_AMOUNT; if (character.Health > CHARACTER_MAX_HEALTH) character.Health = CHARACTER_MAX_HEALTH; }
// Use this for initialization void Start () { newCharacter = new CharacterBase(); classList = new List<CharacterClassBase>(); classList.Add(new CharacterClassThief()); classList.Add(new CharacterClassIceMage()); classList.Add(new CharacterClassFireMage()); classNames = new string[classList.Count]; for(int i = 0; i < classList.Count; i++) { classNames[i] = classList[i].CharacterClassName; } }
// Use this for initialization void Start () { instance = this; weaponSlot = (GunData)GameBase.findObjectByName(init_weaponSlot); items = new ItemData[100]; for(int i = 0; i < init_inventory.Length; i++) { items[i] = GameBase.findObjectByName(init_inventory[i]); } controlAtk.TakeGun(weaponSlot); }
public InAir(CharacterBase temp,string StatusTemp){ characterBase = temp; switch (StatusTemp) { case "Noraml": status = Status.Normal; break; case "Attack": status = Status.Attack; break; case "Dodge": status = Status.Dodge; break; case "BeHit": status = Status.BeHit; break; } }
/// <summary> /// Creates a script for commands that only involve one player and one enemy. /// </summary> /// <param name="action">String that designates the action type</param> /// <param name="attacker">Character that is attacking</param> /// <param name="defender">Character that is defending</param> /// <param name="startPos">Starting position of attacker</param> /// <param name="endPos">Position of the defender</param> /// <param name="battleText">Text for damage numbers</param> /// <returns>A full action script that animates this action in battle</returns> public ActionScript createActionScript(string action, CharacterBase attacker, CharacterBase defender, int damage, BattleText battleText) { Queue<ActionSlot> script = new Queue<ActionSlot>(); Vector2 startPos = attacker.Position; Vector2 endPos = defender.Position - cOffset; // DEBUG: For now, just return the actions for a regular attack script.Enqueue(new ActionSlot(ActionCommand.MoveTo, attacker, endPos, 20)); script.Enqueue(new ActionSlot(ActionCommand.Begin)); script.Enqueue(new ActionSlot(ActionCommand.ShowAttack, attacker)); script.Enqueue(new ActionSlot(ActionCommand.ShowText, battleText)); script.Enqueue(new ActionSlot(ActionCommand.End)); script.Enqueue(new ActionSlot(ActionCommand.TakeDamage, defender, damage)); script.Enqueue(new ActionSlot(ActionCommand.MoveTo, attacker, startPos, 20)); return new ActionScript(script); }
// Use this for initialization void Awake() { localEventManager = new LocalEventManager(); physicsManager = transform.Find("DownCollider").GetComponent<PhysicsManager>(); physicsManager.character = gameObject; characterAttributes = GetComponent<CharacterAttributes>(); inputManager = GetComponent<InputManager>(); inputManager.localEventManager = localEventManager; if(Type!=CharacterType.Player) { transform.Find("UpBody").GetComponent<AudioListener>().enabled = false; inputManager.enabled=false; } switch (Type) { case CharacterType.Player: character=new Player(gameObject); GameManager.Player=transform.Find("DownCollider").gameObject; break; case CharacterType.Enemy: character=new Enemy(gameObject); break; } }
public override IEnumerator RunAnimation(CharacterBase sender, MainSystem sys) { yield return(new SkillWarp().Use(sender, sys)); }
public override IEnumerator Hit(CharacterBase sender, CharacterBase target, MainSystem sys) { target.AddStatus(StatusType.Invisible, 20); yield return(null); }
protected void ApplyDamage(CharacterBase reciver) { CreateDamage(reciver); reciver.ApplayDamage(Damage); }
public void PushAction(BattleAction act, CharacterBase param) { turnActions.Add(new Pair <BattleAction, CharacterBase>(act, param)); }
// ------------------------------------------------------------------------------- // CanUnequip // ------------------------------------------------------------------------------- public virtual bool CanUnequip(CharacterBase target) { return(true); }
void Start() { isMousePressed = false; myline = GetComponent<LineRenderer>(); mypointList = new List<Vector2>(); turningPointList = new List<Vector2>(); allAngle = new List<float>(); allLineVector = new List<Vector2>(); allGradientList = new List<direction>(); mytime = -1; mytFadeTmer = 1.0f; myshape = shape.no_shape; //GameObject[] temp; //temp = GameObject.FindGameObjectsWithTag("Main Player"); //foreach (GameObject a in temp) //{ // if (a.name.Contains("Clone") == true) // GameObject.Destroy(a); // else // mycharbase = a.GetComponent<CharacterBase>(); //} mycharbase = GameObject.FindGameObjectWithTag("Main Player").GetComponent<CharacterBase>(); drawCam = GameObject.Find("draw camera").GetComponent<Camera>(); myline.SetColors(drawColor, drawColor); }
private void SetHealth(CharacterBase Character) { CharactersStatuses[Character].SetHealth(Character.Health, Character.MaxHealth); }
public override void Enact(CharacterBase self) { self.EnterDefenseStance(); }
public override void ConsiderAction(CharacterBase self, CharacterBase enemy, ECoverValue agentLevelOfCoverFromEnemy, ECoverValue enemyLevelOfCoverFromAgent) { #region Agent Cover Check switch (agentLevelOfCoverFromEnemy) { case ECoverValue.None: actionValue -= ((int)Weighting.SuperHeavy / self.enemiesInSight.Count); break; case ECoverValue.Half: actionValue += ((int)Weighting.SuperHeavy / self.enemiesInSight.Count); break; case ECoverValue.Full: actionValue += ((int)Weighting.Light / self.enemiesInSight.Count); break; default: break; } #endregion #region Player Character Cover Check switch (enemyLevelOfCoverFromAgent) { case ECoverValue.None: actionValue += (int)Weighting.SuperHeavy / self.enemiesInSight.Count; break; case ECoverValue.Half: actionValue += (int)Weighting.Heavy / self.enemiesInSight.Count; break; case ECoverValue.Full: actionValue -= (int)Weighting.Light / self.enemiesInSight.Count; break; default: break; } #endregion #region Chance To Hit Player Check int chanceToHit = self.enemiesInSight.Find((characterHitChancePair) => { return(characterHitChancePair.Key == enemy); }).Value; if (chanceToHit > 70) { actionValue -= (int)Weighting.SuperHeavy / self.enemiesInSight.Count; } else if (chanceToHit > 50) { actionValue += (int)Weighting.Light / self.enemiesInSight.Count; } else { actionValue += (int)Weighting.SuperHeavy / self.enemiesInSight.Count; } #endregion #region Number of Players In Sight Check actionValue += self.enemiesInSight.Count > 2 ? ((int)Weighting.Light / self.enemiesInSight.Count) : -((int)Weighting.Heavy / self.enemiesInSight.Count); #endregion }
public override void Enact(CharacterBase self) { self.EnterOverwatchStance(); }
protected int CalculateDamageReduction(CharacterBase target) { return (int)(target.IsOfTypeWizard() ? target.Stats.Defense + target.Stats.MagicResist : target.Stats.Defense); }
/// <summary> /// Adds a single action to the list that moves the party in a given direction using the specified speed. /// </summary> /// <param name="actor">Actor to move on the field</param> /// <param name="direction">Direction to move the party</param> /// <param name="speed">Number of frames to move the actor</param> public void MoveParty(CharacterBase actor, MapDirection direction, int frames) { moveSlot.Action = ActionCommand.WalkTo; moveSlot.Actor = actor; moveSlot.IsAbsolute = false; moveSlot.Frames = frames; switch (direction) { case MapDirection.Up: moveSlot.EndPosition = cMoveUp; break; case MapDirection.Down: moveSlot.EndPosition = cMoveDown; break; case MapDirection.Left: moveSlot.EndPosition = cMoveLeft; break; case MapDirection.Right: moveSlot.EndPosition = cMoveRight; break; } // Mark that the moveSlot is active again moveSlot.Reset(); //moveSlot.Complete += PartyMoveHandler; }
/// <summary> /// Adds a single action to the list that moves the party in a given direction using the default speed. /// </summary> /// <param name="actor">Actor to move on the field</param> /// <param name="direction">Direction to move the party</param> public void MoveParty(CharacterBase actor, MapDirection direction) { actor.Sprite.Motion = "Walk"; moveSlot.Action = ActionCommand.MoveTo; moveSlot.Actor = actor; moveSlot.IsAbsolute = false; moveSlot.Frames = cDefaultMoveFrame; switch (direction) { case MapDirection.Up: moveSlot.EndPosition = cMoveUp; break; case MapDirection.Down: moveSlot.EndPosition = cMoveDown; break; case MapDirection.Left: moveSlot.EndPosition = cMoveLeft; break; case MapDirection.Right: moveSlot.EndPosition = cMoveRight; break; } // Mark that the moveSlot is active again moveSlot.Reset(); moveSlot.Complete += PartyMoveHandler; }
protected int TargetX(CharacterBase character, SceneBattle battle) { List <CharacterBase> characterBaseList = new List <CharacterBase>(); foreach (CharacterBase characterBase in battle.AllHitter()) { if (characterBase is EnemyBase) { if (characterBase.union == character.UnionEnemy) { characterBaseList.Add(characterBase); } } else if (characterBase is Player) { if (characterBase.union == character.UnionEnemy) { characterBaseList.Add(characterBase); } } else if (characterBase is ObjectBase) { ObjectBase objectBase = (ObjectBase)characterBase; if ((objectBase.unionhit || objectBase.union == character.union) && character.UnionEnemy == objectBase.StandPanel.color) { characterBaseList.Add(characterBase); } } } bool flag = false; int num = character.union == Panel.COLOR.red ? 6 : -1; foreach (CharacterBase characterBase in characterBaseList) { if (characterBase.position.Y == character.position.Y) { flag = true; if (character.union == Panel.COLOR.red) { if (num > characterBase.position.X) { num = characterBase.position.X; } } else if (num < characterBase.position.X) { num = characterBase.position.X; } } } if (flag) { return(num - this.UnionRebirth(character.union)); } foreach (CharacterBase characterBase in characterBaseList) { if (characterBase.position.Y != character.position.Y) { if (character.union == Panel.COLOR.red) { if (num > characterBase.position.X) { num = characterBase.position.X; } } else if (num < characterBase.position.X) { num = characterBase.position.X; } } } return(num - this.UnionRebirth(character.union)); }
public override void Render(IRenderer dg, CharacterBase character) { this._rect = new Rectangle(character.animationpoint.X * character.Wide, 4 * character.Height, character.Wide, character.Height); this._position = new Vector2(character.positionDirect.X + Shake.X, character.positionDirect.Y + Shake.Y); dg.DrawImage(dg, character.picturename, this._rect, false, this._position, character.union == Panel.COLOR.blue, Color.White); }
public abstract void Enact(CharacterBase self);
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); content = new ContentManager(ScreenManager.Game.Services, "Content"); // DEBUG: Load a test sprite worldSprite = content.Load<CharacterBase>("TestSprite"); worldSprite.Sprite.ScreenCenter = ChronosSetting.WindowSize / 2; // DEBUG: Load the session Session.LoadSession(ScreenManager); // DEBUG: Load a map //gameEngine.mapEngine.loadMap("Maps\\mountaintest.map"); MapEngine.LoadMapEngine("Maps\\newmaptest.map", ScreenManager.GraphicsDevice, content, worldSprite, director); }
public override void ConsiderActionWithNoEnemyInSight(CharacterBase self) { actionValue -= (int)Weighting.SuperHeavy; }
/// <summary> /// Adds a single action to the list that moves the party in a given direction using the default speed. /// </summary> /// <param name="actor">Actor to move on the field</param> /// <param name="direction">Direction to move the party</param> public void MoveNPC(CharacterBase actor, MapDirection direction) { npcSlots[actor.ID].Action = ActionCommand.WalkTo; npcSlots[actor.ID].Actor = actor; npcSlots[actor.ID].IsAbsolute = false; npcSlots[actor.ID].Frames = 30; switch (direction) { case MapDirection.Up: npcSlots[actor.ID].EndPosition = cMoveUp; break; case MapDirection.Down: npcSlots[actor.ID].EndPosition = cMoveDown; break; case MapDirection.Left: npcSlots[actor.ID].EndPosition = cMoveLeft; break; case MapDirection.Right: npcSlots[actor.ID].EndPosition = cMoveRight; break; } // Mark that the npcSlot is active again npcSlots[actor.ID].Reset(); }
public override void Enact(CharacterBase self) { self.Reload(); }
public void Run(CharacterBase cb) { }
public abstract void ConsiderAction(CharacterBase self, CharacterBase enemy, ECoverValue agentLevelOfCoverFromEnemy, ECoverValue enemyLevelOfCoverFromAgent);
public virtual void DeepClone(CharacterBase dst) { dst.Name = Name; dst.ShowTest = ShowTest; }
/// <summary> /// Attribute score value to the action based solely on the character usually using solely the occupied tile or nothing. /// </summary> /// <param name="self">the character to be evaluating the decision</param> public abstract void ConsiderActionWithNoEnemyInSight(CharacterBase self);
protected virtual void CreateDamage(CharacterBase reciver) { }
public abstract void ConsiderAction(CharacterBase self);
public override IEnumerator Use(CharacterBase sender, MainSystem sys) { sender.AddStatus(StatusType.Invisible, 20); yield return(null); }
public ModifierAbility(UseableAbility useableAbility, CharacterBase ownerCharacter) : base(useableAbility, ownerCharacter) { }
public static void ConsiderSingleTileForMovement(CharacterBase self, Tile tileToConsider) { movementConsiderationList.Sort((MovementConsideration consideration1, MovementConsideration consideration2) => { return(consideration1.CompareTo(consideration2)); }); float tilesValue = 0; for (int i = 0; i < movementConsiderationList.Count; i++) { if (movementConsiderationList[i] is SingleEnemyMovementConsideration) { if (self.enemiesInSight.Count > 0) { foreach (KeyValuePair <CharacterBase, int> enemyHitChancePair in self.enemiesInSight) { (movementConsiderationList[i] as SingleEnemyMovementConsideration).ConsiderTile(ref self, enemyHitChancePair.Key, ref tileToConsider); } //calculates for all seen enemies per consideration as some considerations replace? } else { (movementConsiderationList[i] as SingleEnemyMovementConsideration).ConsiderTileWithNoEnemy(ref self, tileToConsider); } } else if (movementConsiderationList[i] is TileOnlyMovementConsideration) { (movementConsiderationList[i] as TileOnlyMovementConsideration).ConsiderTile(ref tileToConsider); } else if (movementConsiderationList[i] is TileSelfMovementConsideration) { (movementConsiderationList[i] as TileSelfMovementConsideration).ConsiderTile(self, tileToConsider); } tilesValue += movementConsiderationList[i].FinalValue; } //if (tileToConsider.name.Contains("(251)") || // tileToConsider.name.Contains("(371)") || // tileToConsider.name.Contains("(258)") || // tileToConsider.name.Contains("(378)") || // tileToConsider.name.Contains("(327)") || // tileToConsider.name.Contains("(367)") || // tileToConsider.name.Contains("(325)") || // tileToConsider.name.Contains("(365)") || // tileToConsider.name.Contains("(75)") || // tileToConsider.name.Contains("(75)") || // tileToConsider.name.Contains("(77)") || // tileToConsider.name.Contains("(37)") || // tileToConsider.name.Contains("(35)")) //{ // Debug.Log("Tile I am Interested in: " + tileToConsider + ", tilesValue = " + (tilesValue / actionConsiderationList.Count)); //} topTileScoresList.Add(new KeyValuePair <Tile, float>(tileToConsider, tilesValue / actionConsiderationList.Count)); topTileScoresList.Sort((pair1, pair2) => { return(pair2.Value.CompareTo(pair1.Value)); }); while (topTileScoresList.Count > numberTilesToRandomlySelectFrom) { topTileScoresList.RemoveAt(numberTilesToRandomlySelectFrom); } }
public override void Action(CharacterBase character, SceneBattle battle) { if (!this.BlackOut(character, battle, this.name, this.Power(character).ToString())) { return; } switch (this.attackMode) { case 0: if (this.waittime > 2) { this.animePoint = this.AnimeSingleShot(this.waittime); } switch (this.waittime) { case 1: character.animationpoint.X = -1; this.animePoint.X = 0; this.sound.PlaySE(SoundEffect.warp); break; case 18: this.animePoint.X = 5; ++this.attackMode; this.waittime = 0; break; } break; case 1: switch (this.waittime) { case 1: this.animePoint.X = 5; break; case 8: this.chargeEffect = new Charge(this.sound, battle, character.position.X, character.position.Y); battle.effects.Add(chargeEffect); break; case 40: this.chargeEffect.chargeEffect = 2; break; case 72: this.chargeEffect.flag = false; for (int index = 0; index < this.targetY.Length; ++index) { this.targetY[index] = index >= this.hit * 3 ? this.Random.Next(3) : index % 3; } this.targetY = ((IEnumerable <int>) this.targetY).OrderBy <int, Guid>(i => Guid.NewGuid()).ToArray <int>(); ++this.attackMode; this.waittime = 0; break; } break; case 2: this.animePoint = this.AnimeMachinegunRay(this.waittime); switch (this.waittime) { case 3: this.sound.PlaySE(SoundEffect.gun); battle.attacks.Add(this.Paralyze(new BustorShot(this.sound, battle, character.position.X + this.UnionRebirth(character.union), this.targetY[this.atacks], character.union, this.Power(character), BustorShot.SHOT.ranShot, this.element, false, 6))); Debug.WriteLine(atacks); break; case 9: ++this.atacks; if (this.atacks >= this.targetY.Length) { ++this.attackMode; this.animePoint.X = 2; } this.waittime = 0; break; } break; case 3: switch (this.waittime) { case 30: this.animePoint.X = -1; character.parent.effects.Add(new MoveEnemy(this.sound, character.parent, character.position.X, character.position.Y)); break; case 40: character.animationpoint.X = 0; break; } if (this.waittime > 40 && this.BlackOutEnd(character, battle)) { base.Action(character, battle); break; } break; } ++this.waittime; }
public override void Action(CharacterBase character, SceneBattle battle) { if (base.BlackOut(character, battle, this.name, base.Power(character).ToString())) { if (this.moveflame) { switch (this.nowmotion) { case 0: { //this.animePoint.X = this.AnimeMove(this.frame).X; this.animePoint.X = this.AnimeSlash4(this.frame).X; int flame = this.frame; switch (flame) { case 1: character.animationpoint.X = -1; this.xPosition = character.position.X; this.sound.PlaySE(SoundEffect.warp); break; case 2: case 4: break; case 3: if (this.command == 5) { this.xPosition = character.position.X; this.nowmotion++; this.frame = 0; } break; case 5: this.xPosition = this.TargetX(character, battle); if (this.xPosition < 0) { this.xPosition = 0; } if (this.xPosition > 5) { this.xPosition = 5; } break; default: if (flame == 9) { this.nowmotion++; this.frame = 0; } break; } break; } case 1: { this.animePoint.X = this.AnimeSlash4(this.frame).X; int flame2 = this.frame; if (flame2 != 5) { if (flame2 != 6) { if (flame2 == 10) { this.nowmotion++; this.frame = 0; } } else { this.sound.PlaySE(SoundEffect.bombmiddle); base.ShakeStart(2, 16); for (int j = 0; j < 3; j++) { AttackBase attackBase = new BombAttack(this.sound, battle, this.xPosition + (1 + 0) * base.UnionRebirth(character.union), j, character.union, base.Power(character), 4, this.element); attackBase.breaking = true; if (!battle.panel[this.xPosition + (1 + 0) * base.UnionRebirth(character.union), j].OnCharaCheck()) { battle.panel[this.xPosition + (1 + 0) * base.UnionRebirth(character.union), j].Break(); } else { battle.panel[this.xPosition + (1 + 0) * base.UnionRebirth(character.union), j].Crack(); } attackBase.invincibility = false; battle.attacks.Add(this.Paralyze(attackBase)); battle.effects.Add(new Shock(this.sound, battle, attackBase.position.X, attackBase.position.Y, 2, Panel.COLOR.red)); } } } break; } case 2: { int flame3 = this.frame; if (flame3 != 6 && flame3 == 10) { character.parent.effects.Add(new MoveEnemy(this.sound, character.parent, this.xPosition, character.position.Y)); this.end = true; this.nowmotion++; this.frame = 0; } break; } } } if (this.end && base.BlackOutEnd(character, battle)) { base.Action(character, battle); } base.FlameControl(2); } }
public void TryConnectToCharacter(GridCell cell, CharacterBase character, bool userConnection = true) { var previousGridCell = _grid.GetGridCell((int)PreviousSelectedWirePiece.PositionOnGrid.x, (int)PreviousSelectedWirePiece.PositionOnGrid.y); TryConnectToCharacterOverBridge(cell, previousGridCell, character, userConnection); }
public override void Render(IRenderer dg, CharacterBase player) { }
public void TryConnectWireFromCharacter(GridCell batteryCell, GridCell wireCell, CharacterBase character) { if (character.CanConnectViaCell(wireCell)) { var posDiff = batteryCell.GridPos - wireCell.GridPos; posDiff.Normalize(); Direction direction = Direction.None; if (posDiff == Vector2.right) { direction = Direction.Right; } else if (posDiff == Vector2.left) { direction = Direction.Left; } else if (posDiff == Vector2.down) { direction = Direction.Top; } else if (posDiff == Vector2.up) { direction = Direction.Bottom; } if (direction != Direction.None) { var wirePiece = wireCell.DrawableBase as WirePiece; wirePiece.AddConnectionOnGrid(direction, character.PositionOnGrid); wirePiece.UpdateConnections(); character.AddConnection(wirePiece); } } }
protected override void Activate(CharacterBase character) { character.SwitchWeapon(weaponType, ammoCount); }
/// <summary> /// Updates status debugs to be printed /// </summary> /// <param name="character"></param> /// <param name="pos"></param> public static void UpdateDebugMsg(CharacterBase character, Point pos) { singleton.StatusMsg = "Rotation: " + Camera.Rotation + " Position = " + Camera.Position.ToString() + " Zoom: " + Camera.Zoom + "\n"; singleton.StatusMsg += "Char: " + character.Position.ToString() + "\n"; singleton.StatusMsg += "MapChar: " + singleton.player.MapPosition.ToString() + "\n"; /** for (int i = 0; i < singleton.mapActors.Count; i++) { singleton.StatusMsg += "NPC #" + (i + 1) + ": X=" + singleton.mapActors[i].MapPosition.X + " Y=" + singleton.mapActors[i].MapPosition.Y + "\n"; } */ }
public bool TileIntersectsPlayer(Rectangle player, Rectangle block, CharacterBase.MoveDirection direction, out Vector2 depth) { depth = direction == CharacterBase.MoveDirection.Vertical ? new Vector2(0, player.GetVerticalIntersectionDepth(block)) : new Vector2(player.GetHorizontalIntersectionDepth(block), 0); return depth.Y != 0 || depth.X != 0; }
public SpawnPlayer(CharacterBase character) : base(character) { }
/// <summary> /// Loads the specified map from the passed filename /// </summary> /// <param name="filename">Map file to load</param> /// <param name="content">Content manager for loading graphics</param> /// <param name="graphics">Graphics for rendering to the screen</param> /// <param name="playerArg">Player party to be rendered on the screen</param> /// <returns>True if the load succeeded, false otherwise</returns> public static bool LoadMapEngine(string filename, GraphicsDevice graphics, ContentManager content, CharacterBase playerArg, WorldDirector director) { // Clears any previously loaded map ClearMapEngine(); // Create a new instance of the MapEngine singleton = new MapEngine(graphics, content); // Set the player Player = playerArg; // FIX: Store the world director singleton.director = director; // Load the map file // DEBUG: Loading default map singleton.mapInfo = content.Load<MapData>(@"Maps/MapTest"); // DEBUG: Load tests singleton.LoadTests(); // Set Up a 2D Camera singleton.camera = new Camera2D(); ResetToInitialPositions(); singleton.RepositionPlayer(); return true; }
// ------------------------------------------------------------------------------- // CanEquip // ------------------------------------------------------------------------------- public virtual bool CanEquip(CharacterBase target) { return(!target.IsStunned && target.IsAlive && RequirementsMet(target)); }