示例#1
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;
				}
示例#2
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;
				}
示例#3
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();
		
	}