Beispiel #1
0
		public void init(MonsterDataMain aMonster,int aIndex) {
			index = aIndex;
			monster = aMonster;
			
			UIButton b = this.GetComponent<UIButton>();
			UISprite s = this.GetComponent<UISprite>();
			if(monster!=null) {
				monster.LevelChanged += onMonsterChanged;
				initMonster();
				initUnusedMovePointsLevel();
				b.defaultColor = aMonster.elementType.color;
				UITexture t = this.GetComponentInChildren<UITexture>();
				t.enabled = true;
				t.mainTexture = (Texture) Resources.Load("FlatMonsters/"+this.monster.monsterBreedRef.Name.ToLower().Replace(" ",""));
				
				s.color = aMonster.elementType.color;
				
			} else {
				progress.gameObject.SetActive(false);
				b.defaultColor = new Color(0.11f,0.11f,0.11f);
				s.color = new Color(0.11f,0.11f,0.11f);
				this.monsterName.text = "Empty";
				this.monsterLevel.text = "";
				this.initUnusedMovePointsLevel();
				UITexture t = this.GetComponentInChildren<UITexture>();
				t.enabled = false;
			}
			
			
		}
Beispiel #2
0
		public override void initMonster(MonsterDataMain aMonsterRef,EMonsterPos aMyPosition) {
			base.initMonster(aMonsterRef,aMyPosition);
			this._monsterRef.onStatusEffectAdded += onNewStatusEffect;
			this._monsterRef.onStatusEffectRemoved += onRemoveStatusEffect;
			this._monsterRef.onStatusEffectsHPByPercentage += onStatusEffectsHP;
			this._monsterRef.onStatusEffectsHPWithMove += onStatusEffectsHP;
		}
Beispiel #3
0
		public void initMonster(MonsterDataMain aMonster) {
			hp.text = aMonster.MaxHP.ToString();
			meleeAtck.text = aMonster.meleeAttack.ToString();
			meleeDef.text = aMonster.meleeDefense.ToString();
			rangeAtck.text = aMonster.rangeAttack.ToString();
			rangeDef.text = aMonster.rangeDefense.ToString();
			speed.text = aMonster.speed.ToString();
			agility.text = aMonster.agility.ToString();
	//		support.text = aMonster.support.ToString();
			if(monsterDescription!=null)
				monsterDescription.text = aMonster.monsterBreedRef.description; else {
					Debug.LogWarning("Monster Description in ManageMonsterStats Was Null");
				}
			primaryElement.text = aMonster.monsterBreedRef.PrimaryElement.Name;
			if(aMonster.monsterBreedRef.SecondaryElement!=null) {
				this.secondaryElement.text = aMonster.monsterBreedRef.SecondaryElement.Name;
			} else {
				this.secondaryElement.text = "NONE";
			}
			if(aMonster.monsterBreedRef.evolvesTo!=null&&aMonster.monsterBreedRef.evolvesTo.Name!="No Creature") {
				this.evolvesAt.text = "LVL "+aMonster.monsterBreedRef.evolvesAt;
			} else {
				this.evolvesAt.text = "N/A";
			}
		}
Beispiel #4
0
				public BattleInit(NPCBattlesRow aNPCBattle,BetterList<NPCBattleMonstersRow> aNPCMonsters) {
					battleBackground = aNPCBattle._BattleBG;
					if(REF!=null) {
						REF.cleanUp();
					}
					REF = this;
					_npcRef = aNPCBattle;
					this.itemsToAward = aNPCBattle._ItemsReward;
					this.money = aNPCBattle._CashReward;
					teams[0] = new BattleInitTeam();
					teams[0].controlType = ETeamControllerType.SinglePlayerUser;
					Debug.Log("Including NPC Actor: "+aNPCBattle._IncludedNPCActor);
					if(aNPCBattle._IncludedNPCActor!=null&&aNPCBattle._IncludedNPCActor.Length>0) {
						string alliesMonster = DialogueLua.GetActorField(aNPCBattle._IncludedNPCActor,"PrimaryMonster").AsString;
						Debug.Log ("Allies monster is: "+alliesMonster);
						int lev = PlayerMain.REF.highMonster.level;
						MonsterDataMain m = new MonsterDataMain();
						m.initMonster(MonsterLibrary.REF.getMonster(alliesMonster).ID,(byte) lev,true);
						teams[0].addFightingMonster(m,2,aNPCBattle._IncludedNPCActor);
					} 
			
					teams[1] = new BattleInitTeam();
					teams[1].controlType = ETeamControllerType.RegularAI;
					teams[1].initTeamFromBattlesRow(aNPCBattle,aNPCMonsters);;
					forcedConversation = aNPCBattle._ForcedConversation;
					convoNPCName = aNPCBattle._ConversationMainActor;
				}
Beispiel #5
0
		public void initMonster(MonsterDataMain aMonster) {
			ManageMonsterLeftSide leftSide = this.GetComponent<ManageMonsterLeftSide>();
			if(leftSide) {
				leftSide.initMonster(aMonster);
			}
			monster = aMonster;
			
			GameObject bg = BattleBGLibrary.getBGForMonsterType(aMonster.elementType);
		}
Beispiel #6
0
		protected byte indexForMonster(MonsterDataMain aMonster) {
			BetterList<BattleMonster> ms = this.monstersAsBattleMonster;
			
			for(byte i = 0;i<ms.size;i++) {
				if(ms[i].monster==aMonster) {
					return i;
				}
			}
			return 255;
		}
Beispiel #7
0
		public void setMoveToUseItem(ITMItem aItem,MonsterDataMain aMonster) {
			this._itemsForTurn[this.indexForMonster(aMonster)] = aItem;
			
			BetterList<BattleMonster> ms = this.monstersAsBattleMonster;
			
			for(int i = 0;i<ms.size;i++) {
				if(ms[i]!=null&&ms[i].monster==aMonster) {
					ms[i].setFutureMove(aItem);
				}
			}
		}
Beispiel #8
0
		public void initMonster(MonsterDataMain aMonsterRef,EMonsterPos aMyPosition) {
			base.initMonster(aMonsterRef,aMyPosition);
			this.ownersName = aMonsterRef.ownersName;
			moveDataRef = new SelectedMoveData[aMonsterRef.selectedMoves.size];
			for(int i = 0;i<aMonsterRef.selectedMoves.size;i++) {
				moveDataRef[i] = aMonsterRef.selectedMoves[i];

				for(int j = 0;j<3;j++) {
					if(moveDataRef[i].moveData!=null) {
						GameObject g = moveDataRef[i].moveData.attackAnimationPrefab;
						if(g!=null) {
							g.SetActive(false);
							MoveAnimationLibItem.putBackParticles(g);
						}
						g = moveDataRef[i].moveData.attackAnimationHitPrefab;
						if(g!=null) {
							g.SetActive(false); 
							MoveAnimationLibItem.putBackParticles(g);
						}
					}
				}
			}
		}
Beispiel #9
0
		public void initFromMove(SelectedMoveData aMoveData,MonsterDataMain aMonster) {
			if(!aMoveData.validMove) {
				this.gameObject.SetActive(false);
				isLit = false;
				return;
			} else {
				float energy = (float) aMoveData.moveData.energy;
				float maxEnergy = (float) MovesLib.REF.maxMoveEnergy;
				gameObject.SetActive(true);
				
				this.progressBar.value = energy / maxEnergy;;
				if(aMoveData.moveData.energy<=aMonster.energy) {
					if(aMoveData.moveData.Name==null) {
						Debug.LogError("Move Data: "+aMoveData.moveData+" is null");
						return;
					}
					title.text = aMoveData.moveData.Name.ToUpper();
					isLit = true;
				} else {
			//		title.text = "Not Enough Energy!".ToUpper();
					title.text = MovesLib.REF.struggleMove.Name;
					isLit = true;
				
				}
			}
		
			for(int i = 0;i<inactiveStars.Length;i++) {
				if(aMoveData.move.currentUnlockLevel>i) {
					activeStars[i].gameObject.SetActive(true);
					inactiveStars[i].gameObject.SetActive(false);
				} else {
					activeStars[i].gameObject.SetActive(false);
					inactiveStars[i].gameObject.SetActive(true);
				}
			}
			
		}
Beispiel #10
0
		public void initMonster(MonsterDataMain aMonster,BattleMonster aBattleMonster) {
			for(int i = 0;i<buttons.Length;i++) {
				if(aMonster.selectedMoves[i]!=null) {
					if(aMonster.selectedMoves[i].hasMoveData) {
						labels[i].text = aMonster.selectedMoves[i].moveData.Name;
						buttons[i].gameObject.SetActive(true); 
						ElementalType e = aMonster.selectedMoves[i].moveData.elementType;
						ElementalLibrary.REF.recolourButtonForElement(buttons[i].GetComponent<UIButton>(),e);
						} else {
							buttons[i].gameObject.SetActive(false);
						}
				}
			}
			_battleMonster = aBattleMonster;
			if(aMonster.movePointsAvailable>0) {
				if(hasMovePointsAvailable!=null) {
					hasMovePointsAvailable.gameObject.SetActive(true);
				}
			} else {
				if(hasMovePointsAvailable!=null) {
					hasMovePointsAvailable.gameObject.SetActive(false);
				}
			}
		}
Beispiel #11
0
		public void onChangeMoves() {
			changeMoveMonster = this.monster;
			StartCoroutine(loadLevelWithProgress("MoveAssignMoveTree"));
			//Application.LoadLevel("MoveAssignMoveTree");
		}
Beispiel #12
0
		private void initBattleMonsterGameObject(GameObject aMonster,MonsterDataMain aMonsterData,int aLayerOffset,EMonsterPos aPosition) {
			
			BattleMonster monster = aMonster.GetComponent("BattleMonster") as BattleMonster;
			if(monster==null) {
				aMonster.AddComponent<BattleMonster>();
				BattleConstants.positionMonster(aMonster,ETeamPosition.MonsterPreview,EMonsterPos.Front,Vector3.forward);
				monster = aMonster.GetComponent("BattleMonster") as BattleMonster;
			}
			monster.initMonster(aMonsterData,aPosition);
			monster.sortingLayer = "MonsterLayer3";
			previewMonster = monster;
			if(monster.monster==null) {
				Debug.LogError("Monster is null");
			}
		}
Beispiel #13
0
		public void initMonster(MonsterDataMain aMonster) {
			effectName.text = aMonster.passiveEffect.name;
			effectDescription.text = aMonster.passiveEffect.description;
		}
Beispiel #14
0
		private void onMonsterChanged(MonsterDataMain aMonster) {
			initMonster();
			PlayerMain.REF.saveMonsters();
		}
Beispiel #15
0
		private string nameFromMonster(MonsterDataMain aMonster) {
			if(aMonster==null) {
				return "Empty";
			} else {
				return aMonster.name;
			}
		}
Beispiel #16
0
		public void createInventoryForBaits(MonsterDataMain aMonster) {
			if(!moveQueueActive&&opponentTeam.monsterCount==1) {
			//	InventoryDisplay i = AlertGUI.REF.LaunchInventory(EInventoryType.BaitView);
			//	InventoryDisplay.setInventoryTarget(aMonster);
			//	i.createBaitsTable();
			//	i.onHideInventory += this.onHideInventory;
			//	_inventory = i;
			} else { 
				if(opponentTeam.monsterCount>1) {
					AlertGUI.REF.DoGeneralAlert("Cannot Use Bait","You cannot use baits when there is more than one wild monster!");
				}
			}
			
		}
Beispiel #17
0
	public void init(MonsterDataMain aMonster,BattleMonster aBattleMonster) {
		this.GetComponent<ManageMonsterStats>().initMonster(aMonster);
		this.GetComponent<ManageMonsterMoves>().initMonster(aMonster,aBattleMonster);
		this.GetComponent<ManageMonsterPassiveEffect>().initMonster(aMonster);
	}
Beispiel #18
0
				public void addFightingMonster(MonsterDataMain aMonsterMain,string aOwner) {
						aMonsterMain.ownersName = aOwner;
						Debug.Log("Adding monster to use: "+aMonsterMain.name+" Owner is: "+aOwner);
						for(int i = 0;i<monstersToUse.size;i++) {
							if(monstersToUse[i]==null) {
								monstersToUse[i] = aMonsterMain;
								return;
							}
						}
			
						PlayerMain.REF.addMonsterToSeen(aMonsterMain.monsterBreedRef.ID);
						monstersToUse.Add(aMonsterMain);
					}
Beispiel #19
0
		public double xpForDefeating(MonsterDataMain aMyMonster,MonsterDataMain aDefeated) {
			// exp = (((a * b * L) / (5 * s)) * ((Math.pow(2L + 10),2)/Math.pow((L+Lp + 10),2)) + 1) * t * e * p
			// a = 1 if wild, 1.5 if trainer, 2 if tournament
			// b = monster experience yield
			// e = 1.5 if monster is holding sp item, otherwise 1
			// f = 1.2 if monster is happy, 1 otherwise
			// L = level of fainted monster
			// Lp = level of victorious monster
			// p = 1, related to Exp. Point Power
			// s = xp share, unused
			// t = 1 if monster is owned by original owner,
			float a = 1f;
			if(teamType==ETeamControllerType.MultiplayerUser) {
				a = 2f;
			} else if(teamType==ETeamControllerType.RegularAI) {
				a = 1.5f;
			}
			int b = aDefeated.monsterBreedRef.baseExperience;
			
			//TODO check if monster is holding an item
			float e = 2.0f;
			//TODO check if monster is happy
			float f = 2;
			byte l = aDefeated.level;
			byte lp = aMyMonster.level;
			//TODO check if monster is owned by original owner
			return ((a * b * l) / 5) * ((Math.Pow(2*l + 10,(double) 2)/Math.Pow((l+lp + 10),(double) 2)) + 1) * e;
			
		}
Beispiel #20
0
		private void initBattleMonsterGameObject(GameObject aMonster,MonsterDataMain aMonsterData,int aLayerOffset,EMonsterPos aPosition) {
			BattleMonster monster = aMonster.GetComponent("BattleMonster") as BattleMonster;
			if(monster==null) {
				aMonster.AddComponent<BattleMonster>();
				BattleConstants.positionMonster(aMonster,this._position,positionForMonster(aMonster),GameObject.Find("BattleSetup").transform.position);
				monster = aMonster.GetComponent("BattleMonster") as BattleMonster;
			}
			monster.initMonster(aMonsterData,aPosition);
			
			monster.onFaintComplete += onFaintComplete;
			monster.onFainting += onFainting;
			monster.onIdle += onMonsterIdle;
			monster.onCommentaryMessage += onMonsterCommentary;
			monster.transform.parent = this.gameObject.transform;
			if(monster.monster==null) {
				Debug.LogError("Monster is null");
			}
		}
Beispiel #21
0
		public double monstersXPForDefeatingTeam(MonsterDataMain aMyMonster) {
			BetterList<BattleMonster> ms = this.monstersAsBattleMonster;
			double r = 0;
			for(int i = 0;i<ms.size;i++) {
				r += xpForDefeating(aMyMonster,ms[i].monster);
			}
			return r*10;
		}
Beispiel #22
0
		public void initMonster(MonsterDataMain aMonster) {
			monsterName.text = aMonster.name;
			monsterEdit.text = aMonster.name;
			originalMonsterName = monsterName.text;
			GameObject monster =UnityEngine.Object.Instantiate( aMonster.prefab ) as GameObject;
			initBattleMonsterGameObject(monster,aMonster,1,EMonsterPos.Front);
			
		//	previewMonster = new BattleMonster();
	//		previewMonster.initMonster(aMonster,EMonsterPos.Middle);
			ManageMonsterMoves moves = this.GetComponent<ManageMonsterMoves>();
			moves.initMonster(aMonster,this.previewMonster);
			
			ManageMonsterStats stats = this.GetComponent<ManageMonsterStats>();
			stats.initMonster(aMonster);
			
			
			ManageMonsterPassiveEffect passive = this.GetComponent<ManageMonsterPassiveEffect>();
			passive.initMonster(aMonster);
			
		}
Beispiel #23
0
				public MonsterDataMain addNPCMonster (int aMonsterID,byte aMonsterLevel,EMoveBranch aMoveBranchBias,string aNPCName,string aOverrideMove1,string aOverrideMove2,string aOverrideMove3,string aOverrideMove4) {
					MonsterDataMain monster = new MonsterDataMain();
					monster.initMonster(aMonsterID,aMonsterLevel,true);
					monster.ownersName = aNPCName;
					monster.removePassiveEffects();
					if(aOverrideMove1.Length>0) {
						monster.doOverrideMoves(aOverrideMove1,aOverrideMove2,aOverrideMove3,aOverrideMove4);
					}
					monstersToUse.Add(monster);
				
					PlayerMain.REF.addMonsterToSeen(monster.monsterBreedRef.ID);
					return monster;
				}
Beispiel #24
0
		public virtual void initMonster(MonsterDataMain aMonsterRef,EMonsterPos aMyPosition) {
 			_monsterRef = aMonsterRef;
 			if(aMonsterRef==null) {
 				Debug.LogError("Trying to init monster to null monster");
 			}
			_myPosition = aMyPosition;
			createHealthBar();
		}
Beispiel #25
0
		private void moveMonsterToStart(GameObject aGameObject,MonsterDataMain aMonster) {
			string currentName = aGameObject.name;
			int percentSign = currentName.IndexOf("%");
			PlayerMain.REF.moveMonsterToFront(aMonster);
			string tempName = aGameObject.name.Substring(percentSign+1);
			string newName = _currentFront+"%"+tempName;
			aGameObject.name = newName;
			//Debug.Log (nameArray);
			_currentFront--;
			
		}
Beispiel #26
0
	public void postChatVariablesCheck() {

		_checkVars = false;
		Lua.Result animState = DialogueLua.GetVariable("SetPlayerAnimStateAndPause");
		if(animState.AsInt>0) {
			this._avatar.GetComponent<AvatarMover>().doAnimState(animState.AsInt);
			
			_explorer.showInterface(false);
			AvatarMover.setJoystickActive(false);
			StartCoroutine(reEnableControlAfter(3f));
			DialogueLua.SetVariable("SetPlayerAnimStateAndPause",0);
			return;
		} else {
			
			_explorer.showInterface(true);
			AvatarMover.setJoystickActive(true);
		}
		Lua.Result cutscene = DialogueLua.GetVariable("Cutscene");
		if(cutscene.AsString.Length>0||false) {
			switch(cutscene.AsString) {
			case("End"):
				Application.LoadLevel("CreditsMainMenu");
				
				break;
			}
			
			DialogueLua.SetVariable("Cutscene","");
		}
		
		Lua.Result cameraShake = DialogueLua.GetVariable("CameraShake");
		if(cameraShake.AsString.Length>0) {
			switch(cameraShake.AsString) {
				case("Massive"):
					this._explorer.GetComponent<CameraShake>().MassiveShake();
				break;
				case("Large"):
					this._explorer.GetComponent<CameraShake>().LargeShake();
				break;
			}
			
			DialogueLua.SetVariable("CameraShake","");
		}
		Lua.Result terrapedia = DialogueLua.GetVariable("LookupTerrapedia");
		if(terrapedia.AsInt>0) {
			PlayerMain.REF.addMonsterToSeen(terrapedia.AsInt);
			int terrapediaVal = terrapedia.AsInt;
			this._explorer.onTerrapediaClicked();
			this._explorer.openChatOnTerrapediaClose = true;
			DialogueLua.SetVariable("LookupTerrapedia",0);
		}
		if(!changingScene)
			this._explorer.ranchLocationUpdate();
		Lua.Result item = DialogueLua.GetVariable("itemToAward");
		
		if(item.AsString.Length>0) {
			
			PlayerMain.REF.addToInventory(item.AsString);
			DialogueLua.SetVariable("itemToAward","");
			
		}
		Lua.Result toRemove = DialogueLua.GetVariable("MonsterToRemove");
		if(toRemove.AsInt>0) {
			PlayerMain.REF.removeMonsterByMonsterID(toRemove.AsInt);
			DialogueLua.SetVariable("MonsterToRemove",0);
		}
		
		Lua.Result addmonster = DialogueLua.GetVariable("AddMonster");
		if(addmonster.AsInt>0) {
			MonsterLibraryRecord ml = MonsterLibrary.REF.getMonster(addmonster.AsInt);
			MonsterDataMain m = new MonsterDataMain();
			m.initMonster(ml.ID,(byte) (DialogueLua.GetVariable("AddMonsterLevel").AsInt-1),false);
			if(PlayerMain.REF.monsterCount==0) {
				m.energy = m.MaxEnergy/2;
			}
			PlayerMain.REF.addMonster(m,false);
			DialogueLua.SetVariable("AddMonster",0);
		}
		if(onConversationEnded!=null) {
			onConversationEnded(false);
		}
		
		if(DialogueLua.GetVariable("Alert").AsString.Length>0) {
			DialogueManager.ShowAlert(DialogueLua.GetVariable("Alert").AsString);
			DialogueLua.SetVariable("Alert","");
		}
		GameObject player = GameObject.FindGameObjectWithTag("Player");
		if(player!=null) {
			AvatarMover am = player.GetComponent<AvatarMover>();
			ProximitySelector ps = player.GetComponent<ProximitySelector>();
			if(ps.CurrentUsable!=null) {
				NPCForceConvo npc = ps.CurrentUsable.GetComponent<NPCForceConvo>();
				if(npc!=null) {
					am.directRouteTo(new Vector2(npc.dumpOutPosition.x,npc.dumpOutPosition.y));
				}
			}
		}
		
		
		Lua.Result addTriggers = DialogueLua.GetVariable("AddMoverTriggers");
		Lua.Result triggerMovers = DialogueLua.GetVariable("TriggerMoversInNPCS");
		BetterList<string> newList = new BetterList<string>();
		if(addTriggers.AsString.Length>0) {
			string[] data = addTriggers.AsString.Split('|');
			string[] existing = triggerMovers.AsString.Split('|');
			for(int i =0;i<existing.Length;i++) {
				newList.Add(existing[i]);
			}
			for(int i = 0;i<data.Length;i++) {
				bool found = false;
				for(int c = 0;c<existing.Length;c++) {
					if(data[i].Equals(existing[c])) {
						found = true;
					}
				}
				if(!found) {
					newList.Add(data[i]);
				}
			}
			string newListAsString = "";
			for(int i =0;i<newList.size;i++) {
				newListAsString = newListAsString+newList[i];
				if(i<newList.size-1) {
					newListAsString = newListAsString + "|";
				}
			}
			DialogueLua.SetVariable("AddMoverTriggers","");
			DialogueLua.SetVariable("TriggerMoversInNPCS",newListAsString);
			doTriggerMovers(false);
		}
		
		Lua.Result autoStartConvo = DialogueLua.GetVariable("AutoStartNewConvo");
		if(autoStartConvo.AsString.Length>0) {
			ConversationTrigger[] ct = GameObject.FindObjectsOfType<ConversationTrigger>();
			for(int i = 0;i<ct.Length;i++) {
				if(ct[i].conversation == autoStartConvo.AsString) {
					if(!changingScene)
						ct[i].OnUse();
					DialogueLua.SetVariable("AutoStartNewConvo","");
					break;
				}
			}
			
			DialogueLua.SetVariable("AutoStartNewConvo","");
		}
		if(_collidersToRenable.size>0)
			StartCoroutine(restartCollidersIn(0.5f));
			
		CONVO_OPEN = false;
		SaveGameUtils.REF.SaveStatsAndQuests();
		
	}
Beispiel #27
0
				public void addFightingMonster(MonsterDataMain aMonsterMain,int aIndex,string aOwner) {
					Debug.Log("Adding monster to use: "+aMonsterMain.name+" Owner is: "+aOwner);
					aMonsterMain.ownersName = aOwner;
			
					PlayerMain.REF.addMonsterToSeen(aMonsterMain.monsterBreedRef.ID);
					if(monstersToUse[aIndex]!=null) {
						monstersToUse[aIndex+1] = monstersToUse [aIndex];
					}
					monstersToUse[aIndex] = aMonsterMain;
				}