Spaces:
Sleeping
Sleeping
Commit
·
9b6428c
1
Parent(s):
e38635d
a11
Browse files
app.py
CHANGED
|
@@ -7,28 +7,24 @@ import shutil
|
|
| 7 |
import re
|
| 8 |
|
| 9 |
def format_colors(text):
|
| 10 |
-
"""
|
| 11 |
-
|
| 12 |
-
# Primeiro, remover qualquer código ANSI que possa existir
|
| 13 |
import re
|
|
|
|
|
|
|
| 14 |
ansi_pattern = r'\x1b\[[0-9;]*m|\[([0-9;]*)m'
|
| 15 |
text = re.sub(ansi_pattern, '', text)
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
-
text = text.replace(
|
| 20 |
-
text = text.replace(
|
| 21 |
-
text = text.replace(
|
| 22 |
-
text = text.replace('=>', '<span style="color:blue;">=></span>')
|
| 23 |
-
text = text.replace('-N->', '<span style="color:blue;">-N-></span>')
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
text = text.replace(
|
| 27 |
-
text = text.replace(
|
| 28 |
-
text = text.replace(
|
| 29 |
-
text = text.replace(
|
| 30 |
-
text = text.replace('<=', '<span style="color:red;"><=</span>')
|
| 31 |
-
text = text.replace('<-N-', '<span style="color:red;"><-N-</span>')
|
| 32 |
|
| 33 |
return text
|
| 34 |
|
|
@@ -90,7 +86,7 @@ import java.util.Random;
|
|
| 90 |
* - nuclearPower: Poder nuclear (0-10) - Poder do míssil nuclear (dano massivo)
|
| 91 |
*
|
| 92 |
* SÍMBOLOS:
|
| 93 |
-
* - Aeronave: > (Time 1
|
| 94 |
* - Tiro normal: ->
|
| 95 |
* - Tiro supersônico: >>
|
| 96 |
* - Míssil especial: =>
|
|
@@ -245,7 +241,7 @@ import java.util.Random;
|
|
| 245 |
* - nuclearPower: Poder nuclear (0-10) - Poder do míssil nuclear (dano massivo)
|
| 246 |
*
|
| 247 |
* SÍMBOLOS:
|
| 248 |
-
* - Aeronave: < (Time 2
|
| 249 |
* - Tiro normal: <-
|
| 250 |
* - Tiro supersônico: <<
|
| 251 |
* - Míssil especial: <=
|
|
@@ -595,7 +591,7 @@ public class BattleMain {{
|
|
| 595 |
// Tiro nuclear (baixa probabilidade)
|
| 596 |
shot = team1.nuclearMissile(p1PosX, 1);
|
| 597 |
if (shot != null) {{
|
| 598 |
-
System.out.println("
|
| 599 |
}}
|
| 600 |
}} else if (shotType < 15 && team1.doubleShot > 0) {{
|
| 601 |
// Tiro duplo
|
|
@@ -636,7 +632,7 @@ public class BattleMain {{
|
|
| 636 |
// Tiro nuclear (baixa probabilidade)
|
| 637 |
shot = team2.nuclearMissile(p2PosX, -1);
|
| 638 |
if (shot != null) {{
|
| 639 |
-
System.out.println("
|
| 640 |
}}
|
| 641 |
}} else if (shotType < 15 && team2.doubleShot > 0) {{
|
| 642 |
// Tiro duplo
|
|
@@ -699,11 +695,11 @@ public class BattleMain {{
|
|
| 699 |
|
| 700 |
if (random.nextInt(100) >= team1.stealthChance) {{
|
| 701 |
team1.takeDamage(damage);
|
| 702 |
-
System.out.println("
|
| 703 |
}} else {{
|
| 704 |
-
System.out.println("
|
| 705 |
if (team1.radar > 0) {{
|
| 706 |
-
System.out.println("
|
| 707 |
}}
|
| 708 |
}}
|
| 709 |
iterator.remove();
|
|
@@ -732,11 +728,11 @@ public class BattleMain {{
|
|
| 732 |
|
| 733 |
if (random.nextInt(100) >= team2.stealthChance) {{
|
| 734 |
team2.takeDamage(damage);
|
| 735 |
-
System.out.println("
|
| 736 |
}} else {{
|
| 737 |
-
System.out.println("
|
| 738 |
if (team2.radar > 0) {{
|
| 739 |
-
System.out.println("
|
| 740 |
}}
|
| 741 |
}}
|
| 742 |
iterator.remove();
|
|
@@ -764,7 +760,7 @@ public class BattleMain {{
|
|
| 764 |
}}
|
| 765 |
|
| 766 |
// Mostrar status de vida
|
| 767 |
-
System.out.println("
|
| 768 |
System.out.flush();
|
| 769 |
|
| 770 |
// Pausa para visualização
|
|
@@ -776,9 +772,9 @@ public class BattleMain {{
|
|
| 776 |
}}
|
| 777 |
|
| 778 |
if (team1.isAlive()) {{
|
| 779 |
-
System.out.println("
|
| 780 |
}} else {{
|
| 781 |
-
System.out.println("
|
| 782 |
}}
|
| 783 |
System.out.flush();
|
| 784 |
}}
|
|
|
|
| 7 |
import re
|
| 8 |
|
| 9 |
def format_colors(text):
|
| 10 |
+
"""Remove todos os códigos de cor e deixa apenas texto puro"""
|
|
|
|
|
|
|
| 11 |
import re
|
| 12 |
+
|
| 13 |
+
# Remover qualquer código ANSI
|
| 14 |
ansi_pattern = r'\x1b\[[0-9;]*m|\[([0-9;]*)m'
|
| 15 |
text = re.sub(ansi_pattern, '', text)
|
| 16 |
|
| 17 |
+
# Remover códigos unicode de escape
|
| 18 |
+
text = text.replace("\\u001B[31m", "")
|
| 19 |
+
text = text.replace("\\u001B[34m", "")
|
| 20 |
+
text = text.replace("\\u001B[32m", "")
|
| 21 |
+
text = text.replace("\\u001B[0m", "")
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
# Remover códigos sem escape
|
| 24 |
+
text = text.replace("[31m", "")
|
| 25 |
+
text = text.replace("[34m", "")
|
| 26 |
+
text = text.replace("[32m", "")
|
| 27 |
+
text = text.replace("[0m", "")
|
|
|
|
|
|
|
| 28 |
|
| 29 |
return text
|
| 30 |
|
|
|
|
| 86 |
* - nuclearPower: Poder nuclear (0-10) - Poder do míssil nuclear (dano massivo)
|
| 87 |
*
|
| 88 |
* SÍMBOLOS:
|
| 89 |
+
* - Aeronave: > (Time 1)
|
| 90 |
* - Tiro normal: ->
|
| 91 |
* - Tiro supersônico: >>
|
| 92 |
* - Míssil especial: =>
|
|
|
|
| 241 |
* - nuclearPower: Poder nuclear (0-10) - Poder do míssil nuclear (dano massivo)
|
| 242 |
*
|
| 243 |
* SÍMBOLOS:
|
| 244 |
+
* - Aeronave: < (Time 2)
|
| 245 |
* - Tiro normal: <-
|
| 246 |
* - Tiro supersônico: <<
|
| 247 |
* - Míssil especial: <=
|
|
|
|
| 591 |
// Tiro nuclear (baixa probabilidade)
|
| 592 |
shot = team1.nuclearMissile(p1PosX, 1);
|
| 593 |
if (shot != null) {{
|
| 594 |
+
System.out.println("!!! Time 1 lançou um MISSIL NUCLEAR!");
|
| 595 |
}}
|
| 596 |
}} else if (shotType < 15 && team1.doubleShot > 0) {{
|
| 597 |
// Tiro duplo
|
|
|
|
| 632 |
// Tiro nuclear (baixa probabilidade)
|
| 633 |
shot = team2.nuclearMissile(p2PosX, -1);
|
| 634 |
if (shot != null) {{
|
| 635 |
+
System.out.println("!!! Time 2 lançou um MISSIL NUCLEAR!");
|
| 636 |
}}
|
| 637 |
}} else if (shotType < 15 && team2.doubleShot > 0) {{
|
| 638 |
// Tiro duplo
|
|
|
|
| 695 |
|
| 696 |
if (random.nextInt(100) >= team1.stealthChance) {{
|
| 697 |
team1.takeDamage(damage);
|
| 698 |
+
System.out.println("*** Aeronave do Time 1 atingida! -" + damage + " pontos");
|
| 699 |
}} else {{
|
| 700 |
+
System.out.println("--- Aeronave do Time 1 esquivou!");
|
| 701 |
if (team1.radar > 0) {{
|
| 702 |
+
System.out.println("... Radar do Time 1 detectou o projétil!");
|
| 703 |
}}
|
| 704 |
}}
|
| 705 |
iterator.remove();
|
|
|
|
| 728 |
|
| 729 |
if (random.nextInt(100) >= team2.stealthChance) {{
|
| 730 |
team2.takeDamage(damage);
|
| 731 |
+
System.out.println("*** Aeronave do Time 2 atingida! -" + damage + " pontos");
|
| 732 |
}} else {{
|
| 733 |
+
System.out.println("--- Aeronave do Time 2 esquivou!");
|
| 734 |
if (team2.radar > 0) {{
|
| 735 |
+
System.out.println("... Radar do Time 2 detectou o projétil!");
|
| 736 |
}}
|
| 737 |
}}
|
| 738 |
iterator.remove();
|
|
|
|
| 760 |
}}
|
| 761 |
|
| 762 |
// Mostrar status de vida
|
| 763 |
+
System.out.println("Vida Time 1: " + team1.getHealth() + " | Vida Time 2: " + team2.getHealth());
|
| 764 |
System.out.flush();
|
| 765 |
|
| 766 |
// Pausa para visualização
|
|
|
|
| 772 |
}}
|
| 773 |
|
| 774 |
if (team1.isAlive()) {{
|
| 775 |
+
System.out.println("*** Time 1 venceu! ***");
|
| 776 |
}} else {{
|
| 777 |
+
System.out.println("*** Time 2 venceu! ***");
|
| 778 |
}}
|
| 779 |
System.out.flush();
|
| 780 |
}}
|