public override void IniciaGolpe(GameObject G) { tempoDecorrido = 0; addView = false; gP = GolpePersonagem.RetornaGolpePersonagem(G, Nome); }
protected void instanciaEletricidade(GameObject G, Vector3 paraOnde, float tempoMax = 10) { GolpePersonagem golpeP = GolpePersonagem.RetornaGolpePersonagem(G, Nome); if (golpeP.TempoDeInstancia > 0) { carac.posInicial = Emissor.UseOEmissor(G, Nome); } GameObject KY = AuxiliarDeInstancia.InstancieEDestrua(DoJogo.raioEletrico, carac.posInicial, DirDeREpulsao, TempoDeDestroy); Transform KXY = KY.transform.GetChild(0); MonoBehaviour.Destroy(KXY.gameObject, 4.9f); KXY.parent = G.transform.Find(golpeP.Colisor.osso).transform; KXY.localPosition = Vector3.zero; projeteis.Add(KY.transform); MbProjetilEletrico proj = KY.transform.GetChild(2).gameObject.AddComponent <MbProjetilEletrico>(); proj.transform.position += golpeP.DistanciaEmissora * G.transform.forward + golpeP.AcimaDoChao * Vector3.up; proj.KXY = KXY; proj.criatureAlvo = acaoDeGolpeRegenerate.procureUmBomAlvo(G, 350); proj.forcaInicial = paraOnde.normalized; proj.velocidadeProjetil = 9; proj.tempoMax = tempoMax; proj.noImpacto = carac.noImpacto.ToString(); proj.dono = G; proj.esseGolpe = this; addView = true; }
void Start() { gerente = GetComponent <CreatureManager>(); ParaliseNoTempo(); esseGolpe.IniciaGolpe(gameObject); tempoDecorrido -= GolpePersonagem.RetornaGolpePersonagem(gameObject, esseGolpe.Nome).TempoDeInstancia; }
static void CalculaDano(CreatureManager doAtacado, GameObject atacante, IGolpeBase golpe) { float multiplicador = 1; for (int i = 0; i < doAtacado.MeuCriatureBase.CaracCriature.contraTipos.Length; i++) { if (golpe.Tipo.ToString() == doAtacado.MeuCriatureBase.CaracCriature.contraTipos[i].Nome) { multiplicador *= doAtacado.MeuCriatureBase.CaracCriature.contraTipos[i].Mod; } } CriatureBase cDoAtacante = atacante.GetComponent <CreatureManager>().MeuCriatureBase; Atributos A = cDoAtacante.CaracCriature.meusAtributos; int potenciaDoAtacante = (golpe.Caracteristica == caracGolpe.colisao) ? Mathf.RoundToInt(A.Ataque.Minimo + (A.Ataque.Corrente - A.Ataque.Minimo) * Random.Range(0.85f, 1)) : Mathf.RoundToInt(A.Poder.Minimo + (A.Poder.Corrente - A.Poder.Minimo) * Random.Range(0.85f, 1)); GolpePersonagem golpePersonagem = cDoAtacante.GerenteDeGolpes.ProcuraGolpeNaLista(cDoAtacante.NomeID, golpe.Nome); CalculoC(multiplicador, golpe, golpePersonagem, potenciaDoAtacante, doAtacado, cDoAtacante); }
public static GolpePersonagem RetornaGolpePersonagem(GameObject G, nomesGolpes nomeDoGolpe) { CriatureBase criatureBase = G.GetComponent <CreatureManager>().MeuCriatureBase; GerenciadorDeGolpes gg = criatureBase.GerenteDeGolpes; GolpePersonagem gP = gg.ProcuraGolpeNaLista(criatureBase.NomeID, nomeDoGolpe); return(gP); }
static void CalculoB(float multiplicador, IGolpeBase golpe, GolpePersonagem golpePersonagem, int potenciaDoAtacante, CreatureManager doAtacado) { Atributos aDoAtacado = doAtacado.MeuCriatureBase.CaracCriature.meusAtributos; int defesa = Mathf.RoundToInt(aDoAtacado.Defesa.Corrente * Random.Range(0.85f, 1)); int dano = (int)(multiplicador * (golpe.PotenciaCorrente + golpePersonagem.ModPersonagem + potenciaDoAtacante / defesa)); AplicaCalculoComVIsaoDeDano(doAtacado, golpe, aDoAtacado, multiplicador, dano, defesa, potenciaDoAtacante); }
public GolpePersonagem VerificaGolpeDoNivel(nomesCriatures nome, int nivel) { GolpePersonagem retorno = new GolpePersonagem(); listaDeGolpes = ListaDeGolpesAtualizada(nome); for (int i = 0; i < listaDeGolpes.Count; i++) { if (listaDeGolpes[i].NivelDoGolpe == nivel) { retorno = listaDeGolpes[i]; } } return(retorno); }
public GolpePersonagem ProcuraGolpeNaLista(nomesCriatures nome, nomesGolpes esseGolpe) { GolpePersonagem retorno = new GolpePersonagem(); listaDeGolpes = ListaDeGolpesAtualizada(nome); for (int i = 0; i < listaDeGolpes.Count; i++) { if (listaDeGolpes[i].Nome == esseGolpe) { retorno = listaDeGolpes[i]; } } return(retorno); }
static void CalculoA(float multiplicador, IGolpeBase golpe, GolpePersonagem golpePersonagem, int potenciaDoAtacante, CreatureManager doAtacado) { int dano = Mathf.Abs( Mathf.RoundToInt( multiplicador * (golpe.PotenciaCorrente + golpePersonagem.ModPersonagem + potenciaDoAtacante) )); potenciaDoAtacante = dano;//apenas para exibir no print a potencia original do golpe sem a defesa Atributos aDoAtacado = doAtacado.MeuCriatureBase.CaracCriature.meusAtributos; int defesa = Mathf.RoundToInt(aDoAtacado.Defesa.Corrente * Random.Range(0.85f, 1)); if (defesa < 0.75f * dano) { dano = (dano - defesa >= 1)?dano - defesa:1; } else { dano = (int)(0.25f * dano) >= 1 ? Mathf.Max((int)(0.25f * dano * Random.Range(0.9f, 1.15f)), 1) : 1; } /* * if (dano > golpe.DanoMaximo && multiplicador <= 1) * dano = golpe.DanoMaximo; * else if (dano > multiplicador * golpe.DanoMaximo) * { * int mudaUmPoco = Random.Range(-1, 2); * Debug.Log(mudaUmPoco); * dano = Mathf.Max((int)(multiplicador * golpe.DanoMaximo) + mudaUmPoco, 1); * }*/ /* * if (elementos == null) * elementos = GameObject.Find("elementosDoJogo").GetComponent<elementosDoJogo>(); * * mostraDano(elementos, T, dano);*/ AplicaCalculoComVIsaoDeDano(doAtacado, golpe, aDoAtacado, multiplicador, dano, defesa, potenciaDoAtacante); /* * if (X.cAtributos[0].Corrente > 0) * aplicaStatus(T, X, ativa, Y); */ }
public static Vector3 UseOEmissor(GameObject G, nomesGolpes nome) { GolpePersonagem gP = GolpePersonagem.RetornaGolpePersonagem(G, nome); if (GameController.g.estaEmLuta && G.name == "CriatureAtivo") { G.transform.rotation = Quaternion.LookRotation( GameController.g.InimigoAtivo.transform.position - G.transform.position ); } else if (GameController.g.estaEmLuta && G.name != "CriatureAtivo") { GameController.g.InimigoAtivo.IA.SuspendeNav(); } return(G.transform.Find(gP.Colisor.osso).position + G.transform.forward * (gP.DistanciaEmissora) + Vector3.up * gP.AcimaDoChao); }
public static void AplicaProjetil(GameObject G, IGolpeBase ativa, CaracteristicasDeProjetil carac) { GolpePersonagem golpeP = GolpePersonagem.RetornaGolpePersonagem(G, ativa.Nome); if (golpeP.TempoDeInstancia > 0) { carac.posInicial = Emissor.UseOEmissor(G, ativa.Nome); } GameObject KY = AuxiliarDeInstancia.InstancieEDestrua(ativa.Nome, carac.posInicial, ativa.DirDeREpulsao, ativa.TempoDeDestroy); ColisorDeDanoBase proj = null; switch (carac.tipo) { case TipoDoProjetil.rigido: proj = KY.AddComponent <ColisorDeDanoRigido>(); break; case TipoDoProjetil.basico: proj = KY.AddComponent <ColisorDeDano>(); break; case TipoDoProjetil.statusExpansivel: proj = KY.AddComponent <ColisorDeStatusExpansivel>(); break; case TipoDoProjetil.direcional: ColisorDeDanoDirecional projD = KY.AddComponent <ColisorDeDanoDirecional>(); projD.alvo = (G.name == "CriatureAtivo") ? ((GameController.g.InimigoAtivo != null)? GameController.g.InimigoAtivo.gameObject: null) : GameController.g.Manager.CriatureAtivo.gameObject; proj = projD; break; } proj.velocidadeProjetil = ativa.VelocidadeDeGolpe; proj.noImpacto = carac.noImpacto.ToString(); proj.dono = G; proj.esseGolpe = ativa; }
static void CalculaDano(CreatureManager doAtacado, GameObject atacante, IGolpeBase golpe) { float multiplicador = 1; for (int i = 0; i < doAtacado.MeuCriatureBase.CaracCriature.contraTipos.Length; i++) { if (golpe.Tipo.ToString() == doAtacado.MeuCriatureBase.CaracCriature.contraTipos[i].Nome) { multiplicador *= doAtacado.MeuCriatureBase.CaracCriature.contraTipos[i].Mod; } } CriatureBase cDoAtacante = atacante.GetComponent <CreatureManager>().MeuCriatureBase; Atributos A = cDoAtacante.CaracCriature.meusAtributos; int potenciaDoAtacante = (golpe.Caracteristica == caracGolpe.colisao) ? Mathf.RoundToInt(A.Ataque.Minimo + (A.Ataque.Corrente - A.Ataque.Minimo) * Random.Range(0.85f, 1)) : Mathf.RoundToInt(A.Poder.Minimo + (A.Poder.Corrente - A.Poder.Minimo) * Random.Range(0.85f, 1)); int numStatus = StatusTemporarioBase.ContemStatus(TipoStatus.fraco, cDoAtacante); if (numStatus > -1) { potenciaDoAtacante = (int)Mathf.Max(1 / cDoAtacante.StatusTemporarios[numStatus].Quantificador * potenciaDoAtacante, (A.Ataque.Minimo + A.Poder.Minimo) / 2); golpe.ModCorrente = -(int)cDoAtacante.StatusTemporarios[numStatus].Quantificador; } else { golpe.ModCorrente = 0; } GolpePersonagem golpePersonagem = cDoAtacante.GerenteDeGolpes.ProcuraGolpeNaLista(cDoAtacante.NomeID, golpe.Nome); CalculoC(multiplicador, golpe, golpePersonagem, potenciaDoAtacante, doAtacado, cDoAtacante); golpe.VerificaAplicaStatus(cDoAtacante, doAtacado); }
static void CalculoC( float multiplicador, IGolpeBase golpe, GolpePersonagem golpePersonagem, int potenciaDoAtacante, CreatureManager doAtacado, CriatureBase cDoAtacado) { Atributos aDoAtacado = doAtacado.MeuCriatureBase.CaracCriature.meusAtributos; float rd = Random.Range(0.85f, 1); int level = cDoAtacado.CaracCriature.mNivel.Nivel; float STAB = 1; if (cDoAtacado.CaracCriature.TemOTipo(golpe.Tipo)) { STAB = 1.5f; } Debug.Log("modificador de potencia para esse golpe é " + golpePersonagem.ModPersonagem); //int dano = (int)((((((((2 * level / 5) + 2) * potenciaDoAtacante* 20*(golpe.PotenciaCorrente+golpePersonagem.ModPersonagem) )/ aDoAtacado.Defesa.Corrente)/ 50) +2) *STAB * multiplicador) *rd / 100); int dano = (int)(((2 * level + 10) * potenciaDoAtacante * (golpe.PotenciaCorrente + golpePersonagem.ModPersonagem) / (aDoAtacado.Defesa.Corrente + 250) + 2) * STAB * multiplicador * rd); AplicaCalculoComVIsaoDeDano(doAtacado, golpe, aDoAtacado, multiplicador, dano, aDoAtacado.Defesa.Corrente, potenciaDoAtacante); }
public bool Update() { switch (fase) { case FasesDoPassouDeNivel.mostrandoNivel: if (Input.GetMouseButtonDown(0)) { PainelMensCriature.p.EsconderMensagem(); gp = oNivelado.GerenteDeGolpes.VerificaGolpeDoNivel( oNivelado.NomeID, oNivelado.CaracCriature.mNivel.Nivel ); if (gp.Nome != nomesGolpes.nulo) { contadorDeTempo = 0; AprendoOuTentoAprender(); } else { return(true); } } break; case FasesDoPassouDeNivel.aprendeuGolpe: contadorDeTempo += Time.deltaTime; if (contadorDeTempo > 0.5f) { PainelMensCriature.p.AtivarNovaMens( string.Format(bancoDeTextos.RetornaFraseDoIdioma(ChaveDeTexto.aprendeuGolpe), oNivelado.NomeEmLinguas, GolpeBase.NomeEmLinguas(gp.Nome)) , 30 ); GameController.g.HudM.P_Golpe.Aciona(PegaUmGolpeG2.RetornaGolpe(gp.Nome)); fase = FasesDoPassouDeNivel.painelAprendeuGolpeAberto; } break; case FasesDoPassouDeNivel.painelAprendeuGolpeAberto: if (Input.GetMouseButtonDown(0)) { fase = FasesDoPassouDeNivel.finalizar; } break; case FasesDoPassouDeNivel.tentandoAprender: contadorDeTempo += Time.deltaTime; if (contadorDeTempo > 0.5f) { PainelMensCriature.p.AtivarNovaMens( string.Format(bancoDeTextos.RetornaFraseDoIdioma(ChaveDeTexto.tentandoAprenderGolpe), oNivelado.NomeEmLinguas, GolpeBase.NomeEmLinguas(gp.Nome)) , 24 ); HudManager hudM = GameController.g.HudM; hudM.P_Golpe.Aciona(PegaUmGolpeG2.RetornaGolpe(gp.Nome)); hudM.H_Tenta.Aciona(oNivelado.GerenteDeGolpes.meusGolpes.ToArray(), gp.Nome, string.Format(bancoDeTextos.RetornaFraseDoIdioma(ChaveDeTexto.precisaEsquecer), oNivelado.NomeEmLinguas) , QualGolpeEsquecer); fase = FasesDoPassouDeNivel.emEspera; } break; case FasesDoPassouDeNivel.finalizar: PainelMensCriature.p.EsconderMensagem(); GameController.g.HudM.P_Golpe.gameObject.SetActive(false); return(true); } return(false); }
public override void UpdateGolpe(GameObject G) { tempoDecorrido += Time.deltaTime; if (!addView) { GolpePersonagem golpeP = GolpePersonagem.RetornaGolpePersonagem(G, Nome); if (golpeP.TempoDeInstancia > 0) { posInicial = Emissor.UseOEmissor(G, Nome); } AuxiliarDeInstancia.InstancieEDestrua(Nome, posInicial, DirDeREpulsao, TempoDeDestroy); addView = true; } hit = new RaycastHit(); Vector3 ort = Vector3.Cross(DirDeREpulsao, Vector3.up).normalized; float deslocadorInicial = tempoDecorrido > 1 ? tempoDecorrido : 1; float deslocadorFinal = tempoDecorrido < 0.7f ? tempoDecorrido : 0.7f; if (tempoDecorrido < TempoDeDestroy) { Debug.DrawLine(posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao, posInicial + DirDeREpulsao * 25 * deslocadorFinal, Color.red); Debug.DrawLine( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao + 0.25f * Vector3.up, posInicial + 0.25f * Vector3.up + DirDeREpulsao * 25 * deslocadorFinal, Color.red); Debug.DrawLine( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao - 0.25f * Vector3.up, posInicial - 0.25f * Vector3.up + DirDeREpulsao * 25 * deslocadorFinal, Color.red); Debug.DrawLine( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao - 0.25f * ort, posInicial - 0.25f * ort + DirDeREpulsao * 25 * deslocadorFinal, Color.red); if (Physics.Linecast(posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao, posInicial + DirDeREpulsao * 25 * tempoDecorrido, out hit) || Physics.Linecast( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao - 0.25f * Vector3.up, posInicial - 0.25f * Vector3.up + DirDeREpulsao * 25 * tempoDecorrido, out hit) || Physics.Linecast( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao - 0.25f * ort, posInicial - 0.25f * ort + DirDeREpulsao * 25 * tempoDecorrido, out hit) || Physics.Linecast( posInicial + 25 * (deslocadorInicial - 1) * DirDeREpulsao + 0.25f * ort, posInicial + 0.25f * ort + DirDeREpulsao * 25 * tempoDecorrido, out hit) ) { if (impactos % 10 == 0) { GameObject Golpe = GameController.g.El.retorna(DoJogo.impactoDeAgua); Object impacto = MonoBehaviour.Instantiate(Golpe, hit.point, Quaternion.identity); MonoBehaviour.Destroy(impacto, 0.5f); if (impactos == 0) { Dano.VerificaDano(hit.transform.gameObject, G, this); } } impactos++; } } }
public static colisor pegueOColisor(GameObject G, nomesGolpes nomeColisor) { return(GolpePersonagem.RetornaGolpePersonagem(G, nomeColisor).Colisor); }