Inheritance: MonoBehaviour
示例#1
0
 public override void OnEndTurn(Fighter fighter)
 {
     if (fighter.CurrentMP > 0)
     {
         this.ChallengeFailed(fighter);
     }
 }
示例#2
0
	protected void sorcererStart(){
		//important that this happens first, other initializations depend on it
		fighter = (Fighter) GameObject.FindObjectOfType (typeof (Fighter));
		//logically the sorcerer shouldn't be an enabled player unless it's the client in a game
		playerEnabled = false;
		if (Network.isClient) {
			playerEnabled = true;
			fighter.playerEnabled = false;
		}
		
		//inititalize skills before Player start
		activeSkill1 = null;
		activeSkill2 = null;
		activeSkill3 = null;
		activeSkill4 = null;
		activeSkill5 = null;
		activeSkill6 = null;
		
		playerStart ();
		initializePlayer();
		initializeLevel();
		initializePrimaryStats();
		initializeSecondaryStatsBase();
		initializeSecondaryStats();
		calculateSecondaryStats();
		health = maxHealth;
		fighter.energy = fighter.maxEnergy;
		
		target = null;
		startPosition = transform.position;
	
		//networking:
		sorcererNetworkScript = (SorcererNetworkScript)gameObject.GetComponent<SorcererNetworkScript> ();
		//database.readPrimaryStats();
	}
	public static Player Add(Fighter player) {
		if (Players == null) {
			Players = new Fighter[4];
			isFull = false;
			numPlayers = 0;
		}
		for (int i = 0; i < Players.Length; i++) {
			if (Players [i] == null) {
				Players [i] = player;
				numPlayers++;
				UpdateContainer ();
				switch (i) {
				case 0:
					Player1 = player;
					return Player.Player1;
				case 1:
					Player2 = player;
					return Player.Player2;
				case 2:
					Player3 = player;
					return Player.Player3;
				case 3:
					Player4 = player;
					return Player.Player4;
				default:
					Player1 = player;
					return Player.Player1;
				}
			}
		}
		return Player.Null;
	}
        public override void SetUp()
        {
            Params.Load("default.properties");
            List<Entity> children = XNAGame.Instance.Children;
            Fighter leader = new Fighter();
            leader.Position = new Vector3(10, 120, 20);
            leader.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.wander);
            leader.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.obstacle_avoidance);
            leader.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.wall_avoidance);
            children.Add(leader);

            Fighter camFighter = new Fighter();
            camFighter.Leader = leader;
            camFighter.Position = new Vector3(10, 120, 0);
            camFighter.offset = new Vector3(0, 5, 10);
            camFighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.offset_pursuit);
            camFighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.wall_avoidance);
            camFighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.obstacle_avoidance);
            XNAGame.Instance.CamFighter = camFighter;
            children.Add(camFighter);

            Ground ground = new Ground();
            children.Add(ground);
            XNAGame.Instance.Ground = ground;

            XNAGame.Instance.Camera.Position = new Vector3(10, 120, 50);
            foreach (Entity child in children)
            {
                child.LoadContent();
            }
        }
示例#5
0
    private IEnumerator DoSpawn(float delay, Action callback, Transform targetTransform)
    {
        yield return new WaitForSeconds(delay);

        if (!_hasSpawned)
        {
            _fighterInst = Instantiate<Fighter>(FighterPrefab);
            _fighterInst.SpawnVehicle(_fighterInst.gameObject, _fighterInst.VehiclePrefab, Universe.Current.GetUniversePosition(transform.position), transform.rotation);
            if (targetTransform != null)
                _fighterInst.SetTarget(targetTransform);
            if (AddWarpEffect)
            {
                _warpEffect = _fighterInst.VehicleInstance.gameObject.AddComponent<WarpEffect>();
                _warpEffect.transform.position = transform.position;
                _warpEffect.transform.forward = transform.forward;

                _warpEffect.WarpEffectPrefab = SpawnEffect;
                _warpEffect.Timeout = 0.4f;
                _warpEffect.Distance = 20f;
            }
            _hasSpawned = true;
            if (callback != null)
                callback();
            if (OnSpawn != null)
                OnSpawn(_fighterInst.gameObject);
        }
    }
	public static bool Remove(Player player) {
		if (player == Player.Null) {
			return false;
		}
		switch (player) {
		case Player.Player1:
			Player1 = null;
			Players [0] = null;
			break;
		case Player.Player2:
			Player2 = null;
			Players [1] = null;
			break;
		case Player.Player3:
			Player3 = null;
			Players [2] = null;
			break;
		case Player.Player4:
			Player4 = null;
			Players [3] = null;
			break;
		}
		numPlayers--;
		UpdateContainer ();
		return true;
	}
示例#7
0
 public virtual void BeginAttack(Damage damageToDeal, Fighter attacker)
 {
     weaponUser = attacker;
     attackCast.OnHit += OnWeaponHit;
     damageOut = damageToDeal;
     attackCast.Begin ();
 }
示例#8
0
    public virtual bool Fire(Fighter plr, SPoint o, SPoint v)
    {
        plNum = plr.plNum;
        vel = new SPoint (velx*v.x, vely);
        float diff;
        if (!plr.fHelper.IsFacingRight()) {
            diff = ((Mathf.PI / 2) - dir) * 2.0f;
            dir += diff;
        }
        //dir 2.0fis the vector to travel in per second
        //if(active)
        //	return false;
        active=true;
        pos=new SPoint(o.x,o.y+16);
        transform.position = new Vector3 (pos.x, pos.y, 0);

        ttl.SetTimer(2);
        for (int i=0; i<ps.Length; i++) {
            if (ps != null) {
                ps[i].transform.position = new Vector3 (pos.x, pos.y, 0);
                ps[i].enableEmission = true;
                ps[i].Play ();

            }
        }
        return true;
    }
示例#9
0
	// Use this for initialization
	void Start () {

		subscribeToSorcererInstancePublisher (); // jump into game

		fighter = (Fighter) GameObject.FindObjectOfType (typeof (Fighter));
		sorcerer = (Sorcerer)SorcererInstanceManager.getSorcerer (); // sorcerer = (Sorcerer) GameObject.FindObjectOfType (typeof (Sorcerer));
	}
	// Update is called once per frame
	void FixedUpdate() {
		if(mainCamera == null || fighter == null || sorcerer == null){
			mainCamera = GameObject.FindGameObjectWithTag("MainCamera") as GameObject;;
			fighter = GameObject.FindObjectOfType(typeof(Fighter))as Fighter;
			sorcerer = (Sorcerer)SorcererInstanceManager.getSorcerer (); // sorcerer= GameObject.FindObjectOfType (typeof (Sorcerer))as Sorcerer;
		}
		else{
			Player player = (fighter.playerEnabled)? (Player) fighter : sorcerer;
			float distance = Vector3.Distance(mainCamera.transform.position,player.transform.position);
			RaycastHit[] hits = Physics.RaycastAll (mainCamera.transform.position, player.transform.position, distance,checkLayers);
			foreach (GameObject gO in invisibleList){
				gO.layer = LayerMask.NameToLayer(visibleLayerName);
			}
			invisibleList = new List<GameObject>();
			foreach(RaycastHit hit in hits){
				if(Vector3.Distance (mainCamera.transform.position,hit.collider.gameObject.transform.position)<distance){
					hit.collider.gameObject.layer = LayerMask.NameToLayer(invisibleLayerName);
					invisibleList.Add(hit.collider.gameObject);
				}
			}
//			foreach(GameObject gO in gameObjects){
//				if (gO == this.gameObject){
//					this.gameObject.layer = invisibleLayer.value;
//				}
//				else{
//					this.gameObject.layer = visibleLayer.value;
//					}
//			}
		}
		
	}
示例#11
0
 void OnGotHit(Fighter attacker)
 {
     Alive attackersAlive = attacker.GetComponent<Alive>();
     if (!charController.CommandIssued && !attackersAlive.IsDead) {
         charController.Command_Attack( attackersAlive );
     }
 }
示例#12
0
	// Use this for initialization
	void Start () {
		player = (Fighter) GameObject.FindObjectOfType (typeof (Fighter));
		healthFrameWidth = (float)Screen.width*healthFrameWidthFix;
		healthFrameHeight = (float)Screen.height*healthFrameHeightFix;
		healthFillWidth = (float)Screen.width*healthFillWidthFix;
		healthFillHeight =(float)Screen.height*healthFillHeightFix;
	}
        public override void SetUp()
        {
            Params.Load("default.properties");
            List<Entity> children = XNAGame.Instance.Children;

            Ground ground = new Ground();
            children.Add(ground);
            XNAGame.Instance.Ground = ground;

            Fighter fighter = new Fighter();
            fighter.ModelName = "cobramk1";
            fighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.arrive);
            fighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.obstacle_avoidance);
            fighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.wall_avoidance);
            fighter.Position = new Vector3(2, 20, -50);
            fighter.TargetPos = fighter.Position * 2;
            XNAGame.Instance.Leader = fighter;
            children.Add(fighter);

            Fighter fighter1 = new Fighter();
            fighter1.ModelName = "viper";
            fighter1.Target = fighter;
            fighter1.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.pursuit);
            fighter1.Position = new Vector3(-20, 20, -20);
            children.Add(fighter1);
            foreach (Entity child in children)
            {
                child.LoadContent();
            }
        }
示例#14
0
    public void AttackDetect(Fighter plr)
    {
        //projectile checks
        SPoint[] pHdr = new SPoint[8];
        SPoint[] plBox;
        plBox = plr.GetHitBox();
        int hbLen=4;
        float[] plAng ={0, Mathf.PI/2, Mathf.PI, -Mathf.PI/2};
        bool hitflag = true;
                for (int i=0; i<8; i++)
                        pHdr [i] = new SPoint (v [i].x + pos.x, v [i].y +pos.y);
        float atkLen = GetVNum ();
                for (int j = 0; j < atkLen; j++)
                        if (!CheckAxis (pHdr [0], ang [j], plBox, pHdr, hbLen, GetVNum ())) //no axis intersection
                                hitflag = false;

                if (hitflag)//test on the axis of the player hit box to confirm
                        for (int j = 0; j < 4; j++)
                                if (!CheckAxis (plBox [j], plAng [j], plBox, pHdr, hbLen,GetVNum ())) //no axis intersection
                                        hitflag = false;
                if (hitflag) {
                        active = false;
                        plr.GetHit (hitdata);
                        Detonate ();
                }
    }
示例#15
0
 public override void Execute(Fighter fighterRef, PlayerCombatScript combatScript)
 {
     fighterRef.GetComponent<Animator>().SetTrigger(_jumpHash);
        Vector2 v = gameObject.GetComponent<Rigidbody2D>().velocity;
        v.y = _jumpSpeed;
        fighterRef.gameObject.GetComponent<Rigidbody2D>().velocity = v;
 }
示例#16
0
 public override void OnMove(Fighter fighter, int value)
 {
     if (value > 1)
     {
         this.ChallengeFailed(fighter);
     }
 }
示例#17
0
	// Use this for initialization
	void Start () {
		fighter = GameObject.FindObjectOfType<Fighter> ();
		sorcerer = (Sorcerer)SorcererInstanceManager.getSorcerer ();
		idealRatio = maxHeight / maxDistance;
		height = maxHeight;
		distance = maxDistance;
		angle = 45f;
	}
示例#18
0
 public void AddFighter(Fighter fighter)
 {
     m_fighters.Add(fighter);
     fighter.Fight = Fight;
     fighter.OnAdded();
     Fight.UpdateTeam(this);
     fighter.ShowFighter(); // ?????
 }
示例#19
0
 public static void Detonate(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List<Fighter> affecteds, short castcellid)
 {
     var bomb = fighter.Fight.GetFighter(castcellid) as BombFighter;
     if (bomb != null)
     {
         bomb.Detonate();
     }
 }
示例#20
0
	void resetGame () {
		//Remove player fighter
		playerFighter = null;
		//Remove enemies
		EnemyHandler.enemies = new List<Fighter>();
		
		running = false;
	}
示例#21
0
        public IFighter ManufactureFighter(string name, double attackPoints, double defensePoints, bool stealthMode)
        {
            IsNameInUse(name);

            Fighter fighter = new Fighter(name, attackPoints, defensePoints, stealthMode);
            machines.Add(fighter);
            return fighter;
        }
示例#22
0
 public static void MultiplyTakenDamages(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List<Fighter> affecteds, short castcellid)
 {
     foreach (var target in affecteds)
     {
         MultiplyTakenDamageBuff buff = new MultiplyTakenDamageBuff((uint)target.BuffIdProvider.Pop(), effect.BaseEffect.DiceNum, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.Delay);
         target.AddBuff(buff);
     }
 }
示例#23
0
 // Use this for initialization
 void Start()
 {
     player = GetComponent<Round>().Players [0].GetComponent<Fighter> ();
     GameObject.Find ("HealthBar1").GetComponentInChildren<TextMesh> ().text = GetComponent<Round>().Players [0].GetComponent<Fighter>().charType;
     GetComponent<Round>().maxPlayers = 2;
     player.stars = GameManager.roundNum;
     NewWave ();
 }
示例#24
0
 public static void AddState(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List<Fighter> affecteds, short castercellid)
 {
     foreach (var target in affecteds)
     {
         StateBuff buff = new StateBuff((uint)target.BuffIdProvider.Pop(), (short)effect.BaseEffect.Value, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.Delay);
         target.AddBuff(buff);
     }
 }
示例#25
0
 public static void AddRange(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List<Fighter> affecteds, short castcellid)
 {
     foreach (var target in affecteds)
     {
         var definition = new UInt16ReflectedStat(StatsRecord.GetFieldInfo("_Range"), target.FighterStats.Stats);
         target.AddBuff(new StatBuff((uint)target.BuffIdProvider.Pop(), definition, (uint)effect.BaseEffect.EffectType, effect.BaseEffect.DiceNum, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.DiceNum, effect.BaseEffect.Delay));
     }
 }
示例#26
0
 public static void AddVitality(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List<Fighter> affected, short castcellid)
 {
     foreach (var target in affected)
     {
         var definition = new UInt16ReflectedStat(StatsRecord.GetFieldInfo("LifePoints"), target.FighterStats.Stats);
         target.AddBuff(new StatBuff((uint)target.BuffIdProvider.Pop(), definition, (uint)ActionsEnum.ACTION_CHARACTER_BOOST_VITALITY, effect.BaseEffect.DiceNum, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.DiceNum, effect.BaseEffect.Delay));
     }
 }
	//Initialization of variables
	void Start () {
		player = (Fighter) GameObject.FindObjectOfType (typeof (Fighter));
		hp = player.health;
		maxhp = player.maxHealth;
		healthPercent = 1;
		initialGlobeSize = globeSize;
		initialGlobeHeight = globeHeight;
	}
	// Use this for initialization
	void Start () {
		Debug.Log ("Am i second?");
		fighter = (Fighter)GameObject.FindObjectOfType (typeof (Fighter));
		sorcerer = (Sorcerer)SorcererInstanceManager.getSorcerer ();
		fighter.transform.position = initialFighterPosition;
		sorcerer.transform.position = initialSorcererPosition;
		checkSorcererPosition();
	}
示例#29
0
    // Update is called once per frame
    void Update()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Fighter>();

        healthBar.fillAmount = Mathf.Lerp (healthBar.fillAmount, (float)player.PlayerClass.health / (float)player.PlayerClass.maxHealth, 0.05f);

        healthNumbers.GetComponent<Text>().text = player.PlayerClass.health.ToString() + "/" + player.PlayerClass.maxHealth.ToString();
    }
	//Initialization of variables
	void Start (){
		player = (Fighter) GameObject.FindObjectOfType (typeof (Fighter));
		energyPercent = 1;
		energy = player.energy;
		maxEnergy = player.maxEnergy;
		initialGlobeSize = globeSize;
		initialGlobeHeight = globeHeight;
	}
示例#31
0
 public Erosion(Fighter source, SpellLevelRecord level, EffectInstance effect,
                Fighter[] targets, MapPoint castPoint, bool critical)
     : base(source, level, effect, targets, castPoint, critical)
 {
 }
示例#32
0
 public Shoot(Fighter user, double speedcost, double strength) : base(user, speedcost)
 {
     Name = "Flintlock Shot";
     AdditionalReceiverEffects.Add(new QuickProjectile(strength));
 }
示例#33
0
 /// <summary>
 /// Ajoute au royalmouth les points de mouvement apres avoir été poussé
 /// </summary>
 private void RegainMpOnSlided()
 {
     Fighter.RegainMp(Fighter.Id, MpBuffAmount);
 }
示例#34
0
        private int ScorePush(AIProcessor AI, Fighter Target, int Direction, int Length, bool Fear)
        {
            bool           isAlly     = Target.Team == AI.myFighter.Team;
            List <Fighter> TargetList = new List <Fighter>()
            {
                Target
            };
            var LastCell = Target.Cell;
            int Score    = 0;

            foreach (var Layer in Target.Cell.GetObjects <FightGroundLayer>())//On cherche à savoir si décaller de cette cellule est utile
            {
                int LayerScore = 0;
                foreach (var Effect in Layer.CastSpell.Effects)
                {
                    LayerScore = (int)Math.Floor(AIAction.AIActions[AIActionEnum.SELF_ACTING].GetEffectScore(AI, -1, -1, Effect, TargetList, true, true));
                }
                if (Layer is FightBlypheLayer)
                {
                    LayerScore *= 2;
                }
                Score += LayerScore;
            }

            int PathScore   = 4;
            int FinalLength = 0;

            for (int i = 0; i < Length; i++)
            {
                var NextCell = Target.Fight.GetCell(Pathfinder.NextCell(Target.Fight.Map, LastCell.Id, Direction));
                if (NextCell != null)
                {
                    LastCell = NextCell;
                }

                if (NextCell != null && NextCell.IsWalkable())
                {
                    if (NextCell.HasGameObject(FightObjectType.OBJECT_FIGHTER) || NextCell.HasGameObject(FightObjectType.OBJECT_STATIC) || Target.States.HasState(FighterStateEnum.STATE_ENRACINER))
                    {
                        if (!Fear)
                        {
                            PathScore *= EffectPush.RANDOM_PUSHDAMAGE.Next(4, 7);
                            if (isAlly)
                            {
                                PathScore *= -1;
                            }
                        }
                        break;
                    }
                    else if (NextCell.HasGameObject(FightObjectType.OBJECT_TRAP))
                    {//On Stop seulement : ce genre de calcul se fera a la fin.
                        break;
                    }
                }
                else
                {
                    if (!Fear)
                    {
                        PathScore *= EffectPush.RANDOM_PUSHDAMAGE.Next(4, 7);
                        if (isAlly)
                        {
                            PathScore *= -1;
                        }
                    }
                    break;
                }
                FinalLength += 1;
            }
            Score += FinalLength * PathScore;
            if (LastCell != Target.Cell)
            {
                foreach (var Layer in LastCell.GetObjects <FightGroundLayer>())
                {
                    int LayerScore = 0;
                    foreach (var Effect in Layer.CastSpell.Effects)
                    {
                        LayerScore += (int)Math.Floor(AIAction.AIActions[AIActionEnum.SELF_ACTING].GetEffectScore(AI, -1, -1, Effect, TargetList, false, true));
                    }
                    if (Layer is FightTrapLayer) // TODO : Calculate if traplayer others targets
                    {
                        LayerScore *= 4;         //Immediat
                    }
                    else if (Layer is FightBlypheLayer)
                    {
                        LayerScore *= 2;//Debut de tour
                    }
                    Score += LayerScore;
                }
            }

            return(Score);
        }
示例#35
0
 public SpellHistoryEntry(SpellHistory history, SpellLevelRecord spell, Fighter caster, Fighter target, int castRound)
 {
     this.History   = history;
     this.Spell     = spell;
     this.Caster    = caster;
     this.Target    = target;
     this.CastRound = castRound;
 }
示例#36
0
 public override void onLaunchSpell(Fighter Launcher, Spells.SpellLevel Spell, int TargetCellId, Fighter TargetFighter, Dictionary <Spells.EffectInfos, List <Fighter> > TargetEffects, bool IsCC, bool IsEchec)
 {
 }
示例#37
0
 public override void onLaunchWeapon(Fighter Launcher, Database.Models.InventoryItemModel Weapon, int TargetCellId, Fighter TargetFighter, Dictionary <Character.WeaponEffect, List <Fighter> > TargetEffects, bool IsCC, bool IsEchec, bool isPunch)
 {
 }
示例#38
0
        public override Profession GetNewInstance()
        {
            Fighter newFighter = new Fighter(CombatAttribute, MainAttributes);

            return(newFighter);
        }
示例#39
0
 public Berserk(Fighter user, double SpeedCost, double ManaCost, int lifespan, double strengthRatio, double healthTick) : base(user, SpeedCost)
 {
     AdditionalUserEffects.Add(new Uncontrolled(lifespan, healthTick));
     AdditionalUserEffects.Add(new Enraged(lifespan, (User.Strength * strengthRatio) - User.Strength));
 }
示例#40
0
 public Stun(Fighter user, double SpeedCost, double manaCost, int lifespan, double multiplier) : base(user, SpeedCost)
 {
     AdditionalReceiverEffects.Add(new Stunned(lifespan, multiplier));
 }
示例#41
0
 public SpellCastHistory(Fighter fighter)
 {
     Fighter         = fighter;
     m_readOnlyCasts = new ReadOnlyObservableCollectionMT <SpellCast>(m_casts);
 }
示例#42
0
 public void Hit(Fighter enemy)
 {
     enemy.hp -= damage;
 }
示例#43
0
            public void startFight(string n)
            {
                var player = new Fighter(n, 100, 20);

                displayStats(player.Name, player.Health, player.AttackPower, enemy.Name, enemy.Health, enemy.AttackPower);
                Console.WriteLine("\nThe fight begins!");
                Console.WriteLine("\n\n Choose your move\n");

                while (gameRunning)
                {
                    Console.WriteLine("\na)Attack\nb)Block\nc)Charge attack power\nh)Heal\ns)Display stats\n");
                    char userInput = Console.ReadKey().KeyChar;

                    switch (userInput)
                    {
                    case 'a':
                        //Both attack
                        player.attack(player.AttackPower, Enemy.aiMoveSelector(), enemy.AttackPower, enemy.Health);
                        if (player.CurrentMove == Enemy.aiMoveSelector())
                        {
                            enemy.attack(enemy.AttackPower, player.CurrentMove, player.AttackPower, player.Health);
                            Console.WriteLine($"Your health: {player.Health}");
                            Console.WriteLine($"Enemy health: {enemy.Health}");
                        }
                        //Player attacks, AI blocks
                        else if (Enemy.aiMoveSelector() == player.CurrentMove + 1)
                        {
                            enemy.block(player.CurrentMove, player.AttackPower);
                            Console.WriteLine($"Your attack power decresed to: {player.AttackPower}");
                            Console.WriteLine($"Enemy health: {enemy.Health}");
                        }
                        //Player attacks, AI charges
                        else if (Enemy.aiMoveSelector() == player.CurrentMove + 2)
                        {
                            enemy.chargeAttack(player.CurrentMove, player.AttackPower);
                            Console.WriteLine($"Enemy attack power increase to: {enemy.AttackPower}");
                            Console.WriteLine($"Enemy health: {enemy.Health}");
                        }
                        //Player attacks, AI heals
                        else if (Enemy.aiMoveSelector() == player.CurrentMove + 3)
                        {
                            enemy.heal(player.CurrentMove, player.AttackPower);
                            Console.WriteLine($"Enemy health: {enemy.Health}");
                        }
                        break;

                    case 'b':
                        //Both block
                        player.block(Enemy.aiMoveSelector(), enemy.AttackPower);
                        if (player.CurrentMove == Enemy.aiMoveSelector())
                        {
                            enemy.block(player.CurrentMove, player.AttackPower);
                        }
                        //Player blocks, enemy attacks
                        else if (Enemy.aiMoveSelector() == player.CurrentMove - 1)
                        {
                            enemy.attack(enemy.AttackPower, player.CurrentMove, player.AttackPower, player.Health);
                            Console.WriteLine($"Enemy attack power decresed to: {enemy.AttackPower}");
                        }
                        //Player blocks, enemy charges
                        else if (Enemy.aiMoveSelector() == player.CurrentMove + 1)
                        {
                            enemy.chargeAttack(player.CurrentMove, player.AttackPower);
                            Console.WriteLine($"Enemy attack power increased to: {enemy.AttackPower}");
                        }
                        //Player blocks, enemy heals
                        else if (Enemy.aiMoveSelector() == player.CurrentMove + 2)
                        {
                            enemy.heal(player.CurrentMove, player.AttackPower);
                            Console.WriteLine($"Enemy health: {enemy.Health}");
                        }
                        break;

                    case 'c':

                        //Both charge
                        player.chargeAttack(enemy.CurrentMove, enemy.AttackPower);
                        Console.WriteLine($"Player attack increased to: {player.AttackPower}");
                        if (player.CurrentMove == Enemy.aiMoveSelector())
                        {
                            enemy.chargeAttack(player.CurrentMove, player.AttackPower);
                            Console.WriteLine($"Enemy attack increased to: {enemy.AttackPower}");
                        }
                        //Player charges, enemy attacks
                        else if (Enemy.aiMoveSelector() == player.CurrentMove - 2)
                        {
                            enemy.attack(enemy.AttackPower, player.CurrentMove, player.AttackPower, player.Health);
                            Console.WriteLine($"Your health: {player.Health}");
                        }
                        //Player charges, enemy blocks
                        else if (Enemy.aiMoveSelector() == player.CurrentMove - 1)
                        {
                            enemy.block(player.CurrentMove, player.AttackPower);
                        }
                        //Player charges, enemy heals
                        else if (Enemy.aiMoveSelector() == player.CurrentMove + 1)
                        {
                            enemy.heal(enemy.CurrentMove, enemy.AttackPower);
                            Console.WriteLine($"Enemy health: {enemy.Health}");
                        }
                        break;

                    case 'h':

                        //Both heal
                        player.heal(enemy.CurrentMove, enemy.AttackPower);
                        Console.WriteLine($"Your health: {player.Health}");
                        if (Enemy.aiMoveSelector() == player.CurrentMove)
                        {
                            enemy.heal(player.CurrentMove, player.AttackPower);
                            Console.WriteLine($"Enemy health: {enemy.Health}");
                        }
                        //Player heals, enemy attacks
                        else if (Enemy.aiMoveSelector() == player.CurrentMove - 3)
                        {
                            enemy.attack(enemy.AttackPower, player.CurrentMove, player.AttackPower, player.Health);
                            Console.WriteLine($"Your health: {player.Health}");
                        }
                        //Player heals, enemy blocks
                        else if (Enemy.aiMoveSelector() == player.CurrentMove - 2)
                        {
                            Console.WriteLine("Enemy blocks");
                        }
                        //Player heals, enemy charges
                        else
                        {
                            enemy.chargeAttack(player.CurrentMove, player.AttackPower);
                            Console.WriteLine($"Enemy attack increased to: {enemy.AttackPower}");
                        }
                        break;

                    case 's':
                        displayStats(player.Name, player.Health, player.AttackPower, enemy.Name, enemy.Health, enemy.AttackPower);
                        break;

                    default:
                        Console.WriteLine("\nIncorrect input");
                        break;
                    }

                    //Win/Lose condition
                    if (player.Health <= 0)
                    {
                        gameRunning = false;
                        Console.WriteLine("\n\nYou lose");
                    }
                    else if (enemy.Health <= 0)
                    {
                        gameRunning = false;
                        Console.WriteLine("\n\nYou win");
                    }
                }
            }
示例#44
0
 public void Get(Fighter enemy)
 {
     hp -= enemy.damage;
 }
示例#45
0
 public override void onActorMoved(Fighter Fighter, Maps.MovementPath Path, FightCell NewCell)
 {
 }
    //this function is activated by the buttons onClick function
    public void MorabarabaButton(int WhichNumber)
    {
        if (!Phase_2)
        {
            if (Place_Remove)
            {
                MorabarabaSpaces[WhichNumber].image.sprite = PlayerIcons[WhoseTurn];    //turns the pressed button to the player who pressed it icon
                MorabarabaSpaces[WhichNumber].interactable = false;                     //once the button is pressed cannot be pressed again, this is only for certain phases need to set up exceptions

                MarkedSpaces[WhichNumber] = WhoseTurn + 1;                              //identifies what space is marked by who, the +1 if for the checker calculations
                TurnCounter++;


                CheckForThreeInaARow();

                if (Place_Remove)
                {
                    if (WhoseTurn == 0)                                                      //this switches players and indicaes it by activating the sprites
                    {
                        WhoseTurn = 1;
                        TurnIcons[0].SetActive(false);
                        TurnIcons[1].SetActive(true);
                        PB_MaxPieces           = PB_MaxPieces - 1;
                        PB_MaxPieces_Text.text = PB_MaxPieces.ToString();
                    }
                    else
                    {
                        WhoseTurn = 0;
                        TurnIcons[0].SetActive(true);
                        TurnIcons[1].SetActive(false);
                        PG_MaxPieces           = PG_MaxPieces - 1;
                        PG_MaxPieces_Text.text = PG_MaxPieces.ToString();
                    }
                }


                BoardState();
            }
            else if (!Place_Remove)
            {
                MorabarabaSpaces[WhichNumber].image.sprite = PlayerIcons[2];   //The Icon is set to blank on press

                MarkedSpaces[WhichNumber] = -100;                              //Resets the button's value to -100 to not mess with calculations


                // CheckForThreeInaARow();


                if (WhoseTurn == 0)                                                      //this switches players and indicaes it by activating the sprites
                {
                    WhoseTurn = 1;
                    TurnIcons[0].SetActive(false);
                    TurnIcons[1].SetActive(true);
                    PB_MaxPieces           = PB_MaxPieces - 1;
                    PB_MaxPieces_Text.text = PB_MaxPieces.ToString();
                }
                else
                {
                    WhoseTurn = 0;
                    TurnIcons[0].SetActive(true);
                    TurnIcons[1].SetActive(false);
                    PG_MaxPieces           = PG_MaxPieces - 1;
                    PG_MaxPieces_Text.text = PG_MaxPieces.ToString();
                }

                PlaceAPiece();
                //CheckForThreeInaARow();      //turn this on if you I want a player to make a 3 in a row on the row a piece was just removed from
                BoardState();
            }
        }
        else if (Phase_2)                   //buttons are chosen to fight
        {
            if (!AllFightersChosen)         //to check if two fighters are chosen
            {
                if (!Player_1_Chosen)       //if the first one is chose
                {
                    if (MarkedSpaces[WhichNumber] == 1 && WhoseTurn == 0)
                    {
                        // Debug.Log("Picked Blue");
                        WhoseTurn = 1;
                        TurnIcons[0].SetActive(false);
                        TurnIcons[1].SetActive(true);
                        Player_1_Chosen = true;
                        MorabarabaSpaces[WhichNumber].image.sprite = PlayerIcons[2];

                        MarkedSpaces[WhichNumber]      = 101;
                        P1_Fighter_Sprite.image.sprite = PlayerIcons[3];

                        Button           Fighter_1     = MorabarabaSpaces[WhichNumber];
                        ButtonStatScript P1ButtonValue = Fighter_1.GetComponent <ButtonStatScript>();
                        Fighter          P1            = new Fighter
                        {
                            _Attack  = P1ButtonValue.AttackDamage,
                            _Defence = P1ButtonValue.DamageMitigation,
                            _HP      = P1ButtonValue.HealthPoints
                        };

                        Player1_Attack  = P1._Attack;
                        Player1_Defence = P1._Defence;
                        Player1_HP      = P1._HP;
                        P1_Attack_Max   = P1._Attack + Attack_Range;
                        P1_Attack_Min   = P1._Attack - Attack_Range;
                        P1_Defence_Max  = P1._Defence + Defence_Range;
                        P1_Defence_Min  = P1._Defence - Defence_Range;
                    }
                }
                else if (Player_1_Chosen)
                {
                    // Debug.Log("Player 1 has been chosen");
                    if (MarkedSpaces[WhichNumber] == 2 && WhoseTurn == 1)
                    {
                        // Debug.Log("Picked Orange");
                        WhoseTurn = 0;
                        TurnIcons[0].SetActive(true);
                        TurnIcons[1].SetActive(false);

                        MorabarabaSpaces[WhichNumber].image.sprite = PlayerIcons[2];

                        MarkedSpaces[WhichNumber]      = 102;
                        P2_Fighter_Sprite.image.sprite = PlayerIcons[4];

                        Button           Fighter_2     = MorabarabaSpaces[WhichNumber];
                        ButtonStatScript P2ButtonValue = Fighter_2.GetComponent <ButtonStatScript>();
                        Fighter          P2            = new Fighter
                        {
                            _Attack  = P2ButtonValue.AttackDamage,
                            _Defence = P2ButtonValue.DamageMitigation,
                            _HP      = P2ButtonValue.HealthPoints
                        };

                        Player2_Attack  = P2._Attack;
                        Player2_Defence = P2._Defence;
                        Player2_HP      = P2._HP;
                        P2_Attack_Max   = P2._Attack + Attack_Range;
                        P2_Attack_Min   = P2._Attack - Attack_Range;
                        P2_Defence_Max  = P2._Defence + Defence_Range;
                        P2_Defence_Min  = P2._Defence - Defence_Range;

                        AllFightersChosen = true;
                    }
                }
            }
        }
    }
示例#47
0
 public FightGlypheLayer(Fighter Caster, SpellLevel CastSpell, FightCell CastCell, int MasterSpellId, short Duration, String Zone)
     : base(FightObjectType.OBJECT_GLYPHE, Caster, CastSpell, CastCell, MasterSpellId, 0, Zone, Duration)
 {
 }
示例#48
0
 protected override void onTouchAtEndTurn(Fighter target)
 {
 }
示例#49
0
 public override void onBeginTurn(Fighter newFighter)
 {
 }
示例#50
0
 public Lapino(Fighter source, SpellLevelRecord level, MapPoint castPoint, bool criticalHit)
     : base(source, level, castPoint, criticalHit)
 {
 }
示例#51
0
 public override void onWalkOnLayer(Fighter fighter, FightCell newCell)
 {
 }
示例#52
0
 public override void onMiddleTurn(Fighter fighter)
 {
 }
示例#53
0
 void Start()
 {
     mover   = GetComponent <Mover>();
     fighter = GetComponent <Fighter>();
 }
示例#54
0
 /// <summary>
 /// Supprime les effets de l'invulnerabilité donné par Initmouth.
 /// </summary>
 public void DebuffInitmouth()
 {
     Fighter.DispellSpellBuffs(Fighter, InitmouthRecord.Id);
 }
示例#55
0
 public override void onDie(Fighter fighterDead, Fighter Caster)
 {
 }
示例#56
0
 /// <summary>
 /// Initialize le Royalmouth au début du combat
 /// </summary>
 private void Inimouth()
 {
     Fighter.CastSpell(InitmouthRecord, InitmouthRecord.GetLastLevelGrade(), Fighter.CellId, Fighter.CellId, false);
 }
示例#57
0
 public void Attack(float dmg, Fighter opponent)
 {
     opponent.TakeDamage(dmg);
 }
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            Character mycharacter;
            string    chName       = txtChName.Text;
            string    class_option = cboxCharacter.Text;

            switch (class_option)
            {
            case "Wizard":
                mycharacter = new Wizard(chName);
                break;

            case "Rogue":
                mycharacter = new Rogue(chName);
                break;

            case "Cleric":
                mycharacter = new Cleric(chName);
                break;

            case "Fighter":
                mycharacter = new Fighter(chName);
                break;

            default:
                mycharacter = null;
                MessageBox.Show("You MUST select a class");
                break;
            }

            if (mycharacter != null)
            {
                Weapon myweapon;
                string wpName        = cboxWeapon.Text;
                string weapon_option = wpName;

                switch (weapon_option)
                {
                case "Axe":
                    myweapon = new Axe(wpName, "Common");
                    break;

                case "Bow":
                    myweapon = new Bow(wpName, "Common");
                    break;

                case "Dagger":
                    myweapon = new Dagger(wpName, "Common");
                    break;

                case "Spear":
                    myweapon = new Spear(wpName, "Common");
                    break;

                case "Sword":
                    myweapon = new Sword(wpName, "Common");
                    break;

                default:
                    myweapon = null;
                    MessageBox.Show("You MUST select a WEAPON");
                    break;
                }

                if (myweapon != null)
                {
                    mycharacter.Armament = myweapon;

                    if (cboxArmor.Text != "-Select an Armor-")
                    {
                        Armor myarmor = new Armor(cboxArmor.Text, "Common");
                        mycharacter.Suit = myarmor;

                        characters.Add(mycharacter);

                        cboxCharacters.Items.Add(mycharacter.Name);

                        txtChName.Text     = "";
                        cboxCharacter.Text = "-Select a Class-";
                        cboxWeapon.Text    = "-Select a Weapon-";
                        cboxArmor.Text     = "-Select an Armor-";
                    }
                    else
                    {
                        MessageBox.Show("You MUST select an ARMOR");
                    }
                }
            }
        }
示例#59
0
 // Use this for initialization
 void Start()
 {
     rb2d       = GetComponent <Rigidbody2D>();
     controller = fighter.GetComponent <Fighter>();
 }
示例#60
0
 public override void onLeaveFight(Fighter Fighter)
 {
 }