mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Added Stealth tech and Stealth Bombers (#4271)
* Changed some interception-related uniques - "Can not be intercepted" -> "Cannot be intercepted" This really irked me, and the new version is also how it is written in the wiki. - "Reduces damage taken from interception by 50%" -> "Damage taken from interception reduced by [50]%" * Added "Cannot be carried by [unitFilter] units" unique * Added an icon for Stealth * Added Stealth technology and the Stealth Bomber * Possibly fixed incorrect rounding for interception damage bonus * Various code style changes * Made Stealth Bomber interceptable, but with 100% damage reduction
This commit is contained in:
parent
401c10c132
commit
0f0abad5ea
BIN
android/Images/TechIcons/Stealth.png
Normal file
BIN
android/Images/TechIcons/Stealth.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 1010 KiB After Width: | Height: | Size: 1017 KiB |
@ -621,8 +621,14 @@
|
|||||||
{
|
{
|
||||||
"name": "Nanotechnology",
|
"name": "Nanotechnology",
|
||||||
"row": 7,
|
"row": 7,
|
||||||
"prerequisites": ["Robotics","Lasers"],
|
"prerequisites": ["Robotics"],
|
||||||
"quote": "'The impact of nanotechnology is expected to exceed the impact that the electronics revolution has had on our lives.' - Richard Schwartz"
|
"quote": "'The impact of nanotechnology is expected to exceed the impact that the electronics revolution has had on our lives.' - Richard Schwartz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Stealth",
|
||||||
|
"row": 8,
|
||||||
|
"prerequisites": ["Robotics", "Lasers"],
|
||||||
|
"quote": "'Be extremely subtle, even to the point of formlessness, be extremely mysterious, even to the point of soundlessness. Thereby you can be the director of the opponent' state.' – Sun Tzu"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -636,7 +642,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Future Tech",
|
"name": "Future Tech",
|
||||||
"row": 5,
|
"row": 5,
|
||||||
"prerequisites": ["Particle Physics", "Nuclear Fusion", "Nanotechnology"],
|
"prerequisites": ["Particle Physics", "Nuclear Fusion", "Nanotechnology", "Stealth"],
|
||||||
"uniques": ["Who knows what the future holds?", "Can be continually researched"],
|
"uniques": ["Who knows what the future holds?", "Can be continually researched"],
|
||||||
"quote": "'I think we agree, the past is over.' - George W. Bush"
|
"quote": "'I think we agree, the past is over.' - George W. Bush"
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Evasion",
|
"name": "Evasion",
|
||||||
"prerequisites": ["Siege II", "Bombardment II"],
|
"prerequisites": ["Siege II", "Bombardment II"],
|
||||||
"effect": "Reduces damage taken from interception by 50%",
|
"effect": "Damage taken from interception reduced by [50]%",
|
||||||
"unitTypes": ["Bomber"]
|
"unitTypes": ["Bomber"]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1134,7 +1134,7 @@
|
|||||||
"cost": 375,
|
"cost": 375,
|
||||||
"requiredTech": "Radar",
|
"requiredTech": "Radar",
|
||||||
"requiredResource": "Oil",
|
"requiredResource": "Oil",
|
||||||
//"upgradesTo": "Stealth Bomber",
|
"upgradesTo": "Stealth Bomber",
|
||||||
"attackSound": "shot"
|
"attackSound": "shot"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1150,7 +1150,7 @@
|
|||||||
"requiredTech": "Radar",
|
"requiredTech": "Radar",
|
||||||
"requiredResource": "Oil",
|
"requiredResource": "Oil",
|
||||||
"promotions": ["Evasion", "Siege I"],
|
"promotions": ["Evasion", "Siege I"],
|
||||||
//"upgradesTo": "Stealth Bomber",
|
"upgradesTo": "Stealth Bomber",
|
||||||
"attackSound": "shot"
|
"attackSound": "shot"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1350,22 +1350,19 @@
|
|||||||
"requiredResource": "Uranium",
|
"requiredResource": "Uranium",
|
||||||
"uniques": ["Can move after attacking", "No defensive terrain bonus"]
|
"uniques": ["Can move after attacking", "No defensive terrain bonus"]
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
{
|
{
|
||||||
"name": "Stealth Bomber",
|
"name": "Stealth Bomber",
|
||||||
"unitType": "Bomber",
|
"unitType": "Bomber",
|
||||||
"movement": 2,
|
"movement": 2,
|
||||||
"strength": 85,
|
"strength": 85,
|
||||||
"rangedStrength": 65,
|
"rangedStrength": 85,
|
||||||
"range": 20,
|
"range": 20,
|
||||||
"cost": 425,
|
"cost": 425,
|
||||||
"requiredTech": "Stealth",
|
"requiredTech": "Stealth",
|
||||||
"requiredResource": "Aluminum",
|
"requiredResource": "Aluminum",
|
||||||
"uniques": ["Evasion", "6 tiles in every direction always visible"],
|
"uniques": ["Damage taken from interception reduced by [100]%", "Cannot be carried by [Carrier] units", "6 tiles in every direction always visible"],
|
||||||
"attackSound": "shot"
|
"attackSound": "shot"
|
||||||
// cannot be based on carrier
|
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
|
|
||||||
/* Great people */
|
/* Great people */
|
||||||
|
|
||||||
|
@ -578,14 +578,20 @@ object Battle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun tryInterceptAirAttack(attacker: MapUnitCombatant, defender: ICombatant) {
|
private fun tryInterceptAirAttack(attacker: MapUnitCombatant, defender: ICombatant) {
|
||||||
if (attacker.unit.hasUnique("Can not be intercepted")) return
|
if (attacker.unit.hasUnique("Cannot be intercepted")) return
|
||||||
|
// Deprecated since 3.15.6
|
||||||
|
if (attacker.unit.hasUnique("Can not be intercepted")) return
|
||||||
|
// End deprecation
|
||||||
val attackedTile = defender.getTile()
|
val attackedTile = defender.getTile()
|
||||||
for (interceptor in defender.getCivInfo().getCivUnits().filter { it.canIntercept(attackedTile) }) {
|
for (interceptor in defender.getCivInfo().getCivUnits().filter { it.canIntercept(attackedTile) }) {
|
||||||
if (Random().nextFloat() > 100f / interceptor.interceptChance()) continue
|
if (Random().nextFloat() > 100f / interceptor.interceptChance()) continue
|
||||||
|
|
||||||
var damage = BattleDamage.calculateDamageToDefender(MapUnitCombatant(interceptor), null, attacker)
|
var damage = BattleDamage.calculateDamageToDefender(MapUnitCombatant(interceptor), null, attacker)
|
||||||
damage += damage * interceptor.interceptDamagePercentBonus() / 100
|
|
||||||
if (attacker.unit.hasUnique("Reduces damage taken from interception by 50%")) damage /= 2
|
var damageFactor = 1f + interceptor.interceptDamagePercentBonus().toFloat() / 100f
|
||||||
|
damageFactor *= attacker.unit.receivedInterceptDamageFactor()
|
||||||
|
|
||||||
|
damage = (damage.toFloat() * damageFactor).toInt()
|
||||||
|
|
||||||
attacker.takeDamage(damage)
|
attacker.takeDamage(damage)
|
||||||
interceptor.attacksThisTurn++
|
interceptor.attacksThisTurn++
|
||||||
|
@ -14,6 +14,7 @@ import com.unciv.models.ruleset.tile.TileImprovement
|
|||||||
import com.unciv.models.ruleset.unit.BaseUnit
|
import com.unciv.models.ruleset.unit.BaseUnit
|
||||||
import com.unciv.models.ruleset.unit.UnitType
|
import com.unciv.models.ruleset.unit.UnitType
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
import kotlin.math.pow
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -835,6 +836,7 @@ class MapUnit {
|
|||||||
fun canTransport(unit: MapUnit): Boolean {
|
fun canTransport(unit: MapUnit): Boolean {
|
||||||
if (owner != unit.owner) return false
|
if (owner != unit.owner) return false
|
||||||
if (!isTransportTypeOf(unit)) return false
|
if (!isTransportTypeOf(unit)) return false
|
||||||
|
if (unit.getMatchingUniques("Cannot be carried by [] units").any{matchesFilter(it.params[0])}) return false
|
||||||
if (currentTile.airUnits.count { it.isTransported } >= carryCapacity(unit)) return false
|
if (currentTile.airUnits.count { it.isTransported } >= carryCapacity(unit)) return false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -844,6 +846,16 @@ class MapUnit {
|
|||||||
.sumBy { it.params[0].toInt() }
|
.sumBy { it.params[0].toInt() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun receivedInterceptDamageFactor(): Float {
|
||||||
|
var damageFactor = 1f
|
||||||
|
for (unique in getMatchingUniques("Damage taken from interception reduced by []%"))
|
||||||
|
damageFactor *= 1f - unique.params[0].toFloat() / 100f
|
||||||
|
// Deprecated since 3.15.6
|
||||||
|
damageFactor *= 0.5f.pow(getUniques().count{it.text == "Reduces damage taken from interception by 50%"})
|
||||||
|
// End deprecation
|
||||||
|
return damageFactor
|
||||||
|
}
|
||||||
|
|
||||||
private fun getTerrainDamage() {
|
private fun getTerrainDamage() {
|
||||||
// hard coded mountain damage for now
|
// hard coded mountain damage for now
|
||||||
if (getTile().baseTerrain == Constants.mountain) {
|
if (getTile().baseTerrain == Constants.mountain) {
|
||||||
|
@ -472,6 +472,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
|
|||||||
* [Atom](https://thenounproject.com/term/atom/1586852/) By Kelsey Armstrong for Particle Physics
|
* [Atom](https://thenounproject.com/term/atom/1586852/) By Kelsey Armstrong for Particle Physics
|
||||||
* [Thermonuclear fusion](https://thenounproject.com/search/?q=fusion&i=3292735) by Olena Panasovska, UA for Nuclear Fusion
|
* [Thermonuclear fusion](https://thenounproject.com/search/?q=fusion&i=3292735) by Olena Panasovska, UA for Nuclear Fusion
|
||||||
* [telecommunications](https://thenounproject.com/search/?q=telecommunications&i=3191260) by Wichai Wi for Telcommunications
|
* [telecommunications](https://thenounproject.com/search/?q=telecommunications&i=3191260) by Wichai Wi for Telcommunications
|
||||||
|
* [Radar](https://thenounproject.com/term/radar/1546196/) By CINDYFLA, ID for Stealth
|
||||||
* [Information Technology](https://thenounproject.com/term/information-technology/1927668/) By Vectors Markeet for Future Tech
|
* [Information Technology](https://thenounproject.com/term/information-technology/1927668/) By Vectors Markeet for Future Tech
|
||||||
|
|
||||||
## Terrain
|
## Terrain
|
||||||
|
Loading…
x
Reference in New Issue
Block a user