Exemple #1
0
		public static Vector3 getFaceOffPosition(ETeamPosition aPosition,EMonsterPos aMonster,Vector3 aOffset) {
			float faceOffNegator = -1.5f;
			switch(aPosition) {
				case(ETeamPosition.LeftTeam):default: 
					switch(aMonster) {
						case(EMonsterPos.Top):
					return new Vector3(POSITION_TEAM1_1.x+aOffset.x,POSITION_TEAM1_1.y+aOffset.y,POSITION_TEAM1_1.z+faceOffNegator+aOffset.z);
						break;
					case(EMonsterPos.Front):default:
					return new Vector3(POSITION_TEAM1_MIDDLE.x+aOffset.x,POSITION_TEAM1_MIDDLE.y+aOffset.y,POSITION_TEAM1_MIDDLE.z+faceOffNegator+aOffset.z);
						break;
						case(EMonsterPos.Bottom):
					return new Vector3(POSITION_TEAM1_2.x+aOffset.x,POSITION_TEAM1_2.y+aOffset.y,POSITION_TEAM1_2.z+faceOffNegator+aOffset.z);
						break;
					
					}
					break;
			case(ETeamPosition.RightTeam):
				switch(aMonster) {
				case(EMonsterPos.Top):
					return new Vector3(POSITION_TEAM2_1.x+aOffset.x,POSITION_TEAM2_1.y+aOffset.y,POSITION_TEAM2_MIDDLE.z-faceOffNegator+aOffset.z);
					break;
				case(EMonsterPos.Front):default:
					return new Vector3(POSITION_TEAM2_MIDDLE.x+aOffset.x,POSITION_TEAM2_MIDDLE.y+aOffset.y,POSITION_TEAM2_MIDDLE.z-faceOffNegator+aOffset.z);
					break;
				case(EMonsterPos.Bottom):
					return new Vector3(POSITION_TEAM2_2.x+aOffset.x,POSITION_TEAM2_2.y+aOffset.y,POSITION_TEAM2_2.z-faceOffNegator+aOffset.z);
					break;
					
				}
				break; 
			}
		}
Exemple #2
0
		public MoveQueueItem(float aSpeed,MoveLibItem aMoveData,ETeamPosition aTargetTeam,EMonsterPos aTargetMonster,EMonsterPos aActionMonsterPosition) {
			_forcedSpeed = aSpeed;
			_useThisMove = aMoveData;
			targetTeam = aTargetTeam;
			targetMonster = aTargetMonster;
			actionPosition = aActionMonsterPosition;
			firstHit = true;
		}
Exemple #3
0
		public MoveQueueItem(ItemBait aBait,EMonsterCatchResult aResult) {
			_forcedSpeed = float.MaxValue;
			_useThisMove = null;
			targetTeam = ETeamPosition.RightTeam;
			targetMonster = EMonsterPos.Unset;
			actionPosition = EMonsterPos.Unset;
			baitItem = aBait;
			baitResult = aResult;
			firstHit = true;
		}
Exemple #4
0
		public MoveQueueItem(float aSpeed,SelectedMoveData aMoveData,ETeamPosition aTargetTeam,EMonsterPos aTargetMonster,BattleMonsterWithMoves aActionMonster,EMonsterPos aActionMonsterPosition) {
			_speed = aSpeed;
			_move = aMoveData;
			_actionMonster = aActionMonster;
			targetTeam = aTargetTeam;
			targetMonster = aTargetMonster;
			actionPosition = aActionMonsterPosition;
			// Multi hit moves
			timesToHit = 1;
			firstHit = true;

		}
Exemple #5
0
		public void applyHPBoostForMove(MoveLibItem aItem,float aSplashPercent,ETeamPosition aTeamPosition,EMonsterPos aPosition) {
			float boostHP = 0f;
			switch(aItem.powerApplicationType) {
				case(EPowerApplicationTypes.Normal):
					//TODO Do normal power formula for boosting this monsters health
				break;
				
				case(EPowerApplicationTypes.PowerIsPercentOfHP):
					boostHP = (aItem.power/100)*this.monster.MaxHP;
				break;
			}
			if(boostHP>0f) {
				this.addHP(boostHP,aTeamPosition,aPosition);
				doCommentaryMessage(this.name+" healed by "+aItem.Name,ECommentaryMessageType.HealMessage);
			}
		}
Exemple #6
0
		private void onCommentaryMessage(string aMessage,ECommentaryMessageType aMessageType,EMonsterPos aPosition,ETeamPosition aTeam) {
			switch(aMessageType) {
			case(ECommentaryMessageType.DmgInEffective):
				this._commentaryManager.addCommentaryInEffectiveMessage(aMessage,teamFromPosition(aTeam).monsterFromPosition(aPosition).gameObject);
				break;
			case(ECommentaryMessageType.DmgEffective):
				this._commentaryManager.addCommentaryEffectiveMessage(aMessage,teamFromPosition(aTeam).monsterFromPosition(aPosition).gameObject);
				break;
			case(ECommentaryMessageType.StandardMessage):
				this._commentaryManager.addCommentaryMessage(aMessage,aMessageType,ECommentaryMessagePosition.CenterMessage);
				break;
			case(ECommentaryMessageType.DamageMessage):
				this._commentaryManager.addCommentaryMessage(aMessage,aMessageType,aTeam,aPosition,teamFromPosition(aTeam).monsterFromPosition(aPosition).gameObject);
				break;
			case(ECommentaryMessageType.DmgCritical):
				this._commentaryManager.addCommentaryMessage(aMessage,aMessageType,aTeam,aPosition,teamFromPosition(aTeam).monsterFromPosition(aPosition).gameObject);
				break;
			}
		}
Exemple #7
0
		public void takeHP(float aDamage,ETeamPosition aTeamPosition,EMonsterPos aMonsterPosition,bool aCriticalApplied = false) {
			
			moveFlags = moveFlags | EMoveFlag.HealthChanging;
			if(aDamage>this._monsterRef.hp) {
				aDamage = this._monsterRef.hp;
			}
			this.hp -= aDamage;
			
			StartCoroutine(doneHPChange());
			this.doCommentaryMessage(Convert.ToInt32(aDamage).ToString()+"",ECommentaryMessageType.DamageMessage);
			if(aCriticalApplied) {
				this.doCommentaryMessage("Decisive Blow on "+this.name,ECommentaryMessageType.DmgCritical);
			}
			
		}
Exemple #8
0
		public void addEnergy(float aEnergy,ETeamPosition aTeamPosition,EMonsterPos aMonsterPosition) {
			if(aEnergy>0f) {
				moveFlags = moveFlags | EMoveFlag.EnergyChanging;
				
				this.energy += aEnergy;
				GameObject restore = getEffect("RestoreEnergy");
				if(restore!=null)
					restore.transform.position = this.SpawnPosition;
				StartCoroutine(doneEnergyChange());
				this.doCommentaryMessage(aEnergy+"",ECommentaryMessageType.HealMessage);
			}
		}
Exemple #9
0
		public void addHP(float aHeal,ETeamPosition aTeamPosition,EMonsterPos aMonsterPosition) {

			if(aHeal>0f) {
				
				this.doCommentaryMessage(aHeal+"",ECommentaryMessageType.HealMessage);this.hp += aHeal;
				moveFlags = moveFlags | EMoveFlag.HealthChanging;
				
				StartCoroutine(doneHPChange());
				GameObject restore = getEffect("RestoreHealth");
				if(restore!=null)
					restore.transform.position = this.SpawnPosition;
				this.doCommentaryMessage(aHeal+"",ECommentaryMessageType.HealMessage);
			}
			
		}
Exemple #10
0
		// TODO Apply HP Boosts to team?
		public bool applyHPBoostsToTeam(PassiveEffect aEffect,BattleMonster aActioningMonster,MoveQueueItem aMoveQueueItem,ETeamPosition aTeamPosition) {
			if(containsMonster(aActioningMonster)) {
				ESplashRange splash = aEffect.moveRef.splashRange;
				float splashPercent = aEffect.moveRef.splashPercent;
				if(aEffect.applyAt==EWhenToApply.WhenHitByMoveTypeAtEndOfMoveQueue&&((aMoveQueueItem.moveData.elementType==aEffect.whenMoveElementType)||(aEffect.whenMoveElementType==null))) {
				
					EMonsterPos target = positionForMonster(aActioningMonster);
					BetterList<BattleMonster> targets = getBoostTargetsForMove(target,aEffect.moveRef,aActioningMonster);
					
					if(targets.size>0) {
						for(int i =0;i<targets.size;i++) {
							if(i==0)
								targets[i].applyHPBoostForMove(aEffect.moveRef,1.0f,aTeamPosition,positionForMonster(targets[i])); else {
								targets[i].applyHPBoostForMove(aEffect.moveRef,splashPercent,aTeamPosition,positionForMonster(targets[i]));
							}
						}
					} else {
						
					}
				}
			} else {
				
			}
			return false;
		}
Exemple #11
0
		public void addCommentaryMessage(string aMessage,ECommentaryMessageType aType,ETeamPosition aTeamPosition,EMonsterPos aMonsterPosition,GameObject aMonster) {
			BattleMonster bm = aMonster.GetComponent<BattleMonster>();
			HUDText h = bm.healthBar.GetComponentInChildren<HUDText>();
 
			if(h!=null)
			h.Add(aMessage,Color.blue,1f); else Debug.Log (aMonster);
	/*		GameObject prefab;
			if(aType!=ECommentaryMessageType.DmgCritical) {
				prefab = NGUITools.AddChild(this.gameObject.transform.parent.gameObject,commentaryDamageMessage);
				
			} else {
				prefab = NGUITools.AddChild(this.gameObject.transform.parent.gameObject,this.commentaryDecisiveBlow);
				
			}
				UILabel label = prefab.GetComponent<UILabel>();
			label.text = aMessage;
		//	UIFollowTarget followTarget = prefab.GetComponent("UIFollowTarget") as UIFollowTarget;
			//UIFollowTarget followTarget = (UIFollowTarget) prefab.AddComponent<UIFollowTarget>();
			/*followTarget.initTarget(aMonster.gameObject.transform);;
			if(aType==ECommentaryMessageType.DmgCritical) {
				
				followTarget.heightToAddPerFrame = 0f;
				followTarget.heightOffset = 30;
				
			} else {
				followTarget.heightToAddPerFrame = 2f;
				followTarget.heightOffset = 10;
			}
			prefab.transform.localScale = new Vector3(1f,1f,1f);
			
			TweenAlpha.Begin(prefab,damageFadeSpeed,0.0f);
			
			//TweenPosition.Begin(prefab,damageMoveSpeed,new Vector3(prefab.transform.position.x,prefab.transform.position.y+yDistance,prefab.transform.position.z));
			Destroy(prefab,damageFadeSpeed);*/
		}
Exemple #12
0
		public virtual void initFromData(BattleInitTeam aTeamInit,ETeamPosition aPosition) {
			_teamType = aTeamInit.controlType;
		}
Exemple #13
0
		public void setFutureMove(MoveLibItem aMoveData,ETeamPosition aTargetTeam,EMonsterPos aTargetMonster,bool aAutomatic) {
			for(byte i = 0;i<moves.size;i++) {
				
				if(moves[i]!=null&&moves[i].moveData!=null&&moves[i].moveData.Name==aMoveData.Name) {
					setFutureMove (i,aTargetTeam,aTargetMonster,aAutomatic);
					return;
				}
			}
			
			
		}
Exemple #14
0
		public MoveQueueItem(ITMItem aItem,BattleMonsterWithMoves aActionMonster) {
			this._actionMonster = aActionMonster;
			_forcedSpeed = float.MaxValue;
			_useThisMove = null;
			targetTeam = ETeamPosition.RightTeam;
			targetMonster = EMonsterPos.Unset;
			actionPosition = EMonsterPos.Unset;
			usedItem = aItem;
			firstHit = true;
		}
Exemple #15
0
		public static void positionMonster(GameObject aMonsterObject,ETeamPosition aTeam,EMonsterPos aMonsterPosition,Vector3 aOffset) {
		
			Vector3 useVec = POSITION_TEAM1_MIDDLE;
			Quaternion useQ = new Quaternion(0,0,0,0);
			int layer = 8;
			switch(aTeam) {
				case(ETeamPosition.RightTeam): {
				
					switch(aMonsterPosition) {
						case(EMonsterPos.Top): useVec = POSITION_TEAM2_1;useQ = Quaternion.Euler(0,12,0);break;
						case(EMonsterPos.Front): useVec = POSITION_TEAM2_MIDDLE;useQ = Quaternion.Euler(0,0,0);break;
						case(EMonsterPos.Bottom): useVec = POSITION_TEAM2_2;useQ = Quaternion.Euler(0,-10,0);break;
					}
				}
				break;
				case(ETeamPosition.LeftTeam): {
					switch(aMonsterPosition) {
						case(EMonsterPos.Top): useVec = POSITION_TEAM1_1;useQ = Quaternion.Euler(0,170,0);;break;
						case(EMonsterPos.Front): useVec = POSITION_TEAM1_MIDDLE;useQ = Quaternion.Euler(0,180,0);break;
						case(EMonsterPos.Bottom): useVec = POSITION_TEAM1_2;useQ =useQ = Quaternion.Euler(0,-170,0);break;
					}
				}
				break;
				case(ETeamPosition.MonsterPreview): {
					useVec = POSITION_PREVIEW;useQ = Quaternion.Euler(0,0,0);break;
				}
				case(ETeamPosition.MonsterPreviewRight): {
					useVec = POSITION_PREVIEW_RIGHT;useQ = Quaternion.Euler(0,180,0);break;
				}
			}
			if(aMonsterObject!=null) {
				BattleMonster monster = aMonsterObject.GetComponent("BattleMonster") as BattleMonster;
				monster.initTargetDefaults (aTeam, aMonsterPosition); 
				Vector3 tempvect = new Vector3(useVec.x+aOffset.x, useVec.y+aOffset.y, useVec.z+aOffset.z);
				aMonsterObject.transform.position = tempvect;
				aMonsterObject.transform.rotation =useQ;
				aMonsterObject.transform.localScale = MONSTER_SCALE;
				aMonsterObject.layer = layer;
				Renderer[] allRenderers = aMonsterObject.GetComponentsInChildren<Renderer>();
				byte offset = 0;
				string monsterLayer = "MonsterLayer1";
				switch(aMonsterPosition) {
					case(EMonsterPos.Top):
					break;
					case(EMonsterPos.Front):
					offset = 50;
					monsterLayer = "MonsterLayer2";
					break;
					case(EMonsterPos.Bottom):
					offset = 100;
					monsterLayer = "MonsterLayer3";
					break;
				}
				if(allRenderers.Length==1) {
					Debug.Log("1");
				}
				for(int i = 0;i<allRenderers.Length;i++) {
					allRenderers[i].sortingLayerName = monsterLayer;
			//		SortingOrderUpdate sortOrder = allRenderers[i].GetComponent<SortingOrderUpdate>();
				//	sortOrder.sortOffset = offset;
					allRenderers[i].sortingOrder += offset;
					if(allRenderers[i].gameObject.name.ToLower().Contains("shadow")) {
						allRenderers[i].sortingLayerName = "BackgroundLayer";
						allRenderers[i].sortingOrder = 2;
					}
				}
				
			}
			
		}
Exemple #16
0
		public void setAIFutureMove(ETeamPosition aMyTeamPosition) {
			bool moveAllowed = false;
			int c = 10;
			while(c>=0&&!moveAllowed) {
				c--;
				byte move = (byte) (BattleRandomizer.random*this.moves.size);
				SelectedMoveData moveData = moves[move];
				while(moveData==null||moveData.moveData==null) {
					move = (byte) (BattleRandomizer.random*this.moves.size);
					moveData = moves[move];

				}
				if((moveData.move!=null&&moveData.move.itemRef!=null&&moveData.move.itemRef.moveData!=null)&&_lastMoveNameString==moveData.move.itemRef.moveData.Name) {
					moveAllowed = false;
				} else {
					moveAllowed = true;
				} 
				if(moveAllowed) {
					if(moveData.move!=null&&moveData.move.moveBranch!=null&&moveData.move.moveBranch==EMoveBranch.SupportingBranch) {
						_lastMoveNameString = moveData.move.itemRef.moveData.Name;
					} else {
						_lastMoveNameString = "";
					}
					if(_futureMoveInfo!=null) {
						_futureMoveInfo.cleanUp();
						_futureMoveInfo =null; 
					}
					
					if(moveData.moveData.isBoost) {
						_futureMoveInfo = new MoveQueueItem(this.speed,moveData,aMyTeamPosition,this._targetMonster,this,this.myPosition);
					} else 
						_futureMoveInfo = new MoveQueueItem(this.speed,moveData,this._targetTeam,this._targetMonster,this,this.myPosition);
					if(onMoveSet!=null) {
						onMoveSet(this as BattleMonster,this._futureMoveInfo.moveData,true);
					}
				}
				
			}
			

		}
Exemple #17
0
		public void setFutureMove(byte aMoveIndex,ETeamPosition aTargetTeam,EMonsterPos aTargetMonster,bool aAutomatic) {
			
			SelectedMoveData moveData = null;
			if(aMoveIndex<moves.size) 
				moveData = moves[aMoveIndex]; else {
					moveData = new SelectedMoveData();
				}
			if(_futureMoveInfo!=null) {
				_futureMoveInfo.cleanUp();
				_futureMoveInfo =null;
			}
			_futureMoveInfo = new MoveQueueItem(this.speed,moveData,aTargetTeam,aTargetMonster,this,this.myPosition);
			if(onMoveSet!=null) {
				onMoveSet(this as BattleMonster,this._futureMoveInfo.moveData,aAutomatic);
			}
			
		}
Exemple #18
0
		protected BattleTeam teamFromPosition(ETeamPosition aPosition) {
			if(aPosition==ETeamPosition.LeftTeam) {
				return _teams[0];
			} else {
				return _teams[1];
			}
		}
Exemple #19
0
		public void initTargetDefaults(ETeamPosition aMyTeam,EMonsterPos aMyPosition) {
			switch (aMyTeam) {
				default:_targetTeam = ETeamPosition.LeftTeam;break;
				case(ETeamPosition.LeftTeam):_targetTeam = ETeamPosition.RightTeam;break;
			}
			this._targetMonster = aMyPosition;
		}
Exemple #20
0
		public void initFromData(BattleInitTeam aTeamInit,ETeamPosition aPosition) {
			_position = aPosition;
			BetterList<MonsterDataMain> monsters = aTeamInit.monsters;
			
			this.name = aTeamInit.name;
			//setMiddleMonster(monsters);
			//setTopMonster(monsters);
			//setBottomMonster(monsters);
				findSpaceForMonster(monsters);
			for(byte i = 0;i<this._monsters.Length;i++) {
				if(_monsters[i]!=null) {
					BattleConstants.positionMonster(_monsters[i],this._position,positionForMonster(_monsters[i]),GameObject.Find("BattleSetup").transform.position);
					BattleMonster monster = _monsters[i].GetComponent("BattleMonster") as BattleMonster;
				//	monster.myPosition = positionForMonster(_monsters[i]);
					
					if(monster!=null) {
						monster.onMoveSet += onMonsterMoveSet;
					}
					if(aTeamInit.controlType==Battles.ETeamControllerType.WildAI) {
						monster.monster.ownershipStatus = EOwnershipStatus.Wild;
					}
				}
			}
			base.initFromData(aTeamInit,aPosition);
		}