-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac48df4
commit 95fcb65
Showing
8 changed files
with
519 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
TFMvMUpgrades | ||
{ | ||
/** | ||
* NavBot TF2 MvM Upgrade priority configuration file | ||
* | ||
* Defines which upgrades each class should buy | ||
* | ||
* Look at scripts/items/mvm_upgrades.txt | ||
* | ||
* "scout" -- class section | ||
* { | ||
* "upgrade" -- this must always be named "upgrade" | ||
* { | ||
* "attribute" "damage bonus" -- attribute name, must match an attribute defined in the game's upgrade script file | ||
* "quality" "2" -- can be omitted, 2 is the default quality. Omit this unless it's also specified in the game's upgrade script file | ||
* | ||
* priority, bots will buy upgrades with the lowest priority first. | ||
* in case two or more upgrades have the same priority, they will be selected randomly | ||
* "priority" "1" | ||
* "slot" "0" -- weapon slot used by this upgrade, -1 for player upgrades, 9 for canteen power up bottle | ||
* "weapons" "5,7,333" -- comma-delimited list of item definition index this upgrade is restricted to | ||
* } | ||
* } | ||
* | ||
*/ | ||
|
||
"scout" | ||
{ | ||
// Scout, priorize blast and bullet res + mobility first, then fire res + jump mobility, then health regen | ||
|
||
"upgrade" | ||
{ | ||
"attribute" "dmg taken from blast reduced" | ||
"priority" "1" | ||
"slot" "-1" | ||
} | ||
"upgrade" | ||
{ | ||
"attribute" "dmg taken from bullets reduced" | ||
"priority" "1" | ||
"slot" "-1" | ||
} | ||
"upgrade" | ||
{ | ||
"attribute" "dmg taken from crit reduced" | ||
"priority" "1" | ||
"slot" "-1" | ||
} | ||
"upgrade" | ||
{ | ||
"attribute" "move speed bonus" | ||
"priority" "1" | ||
"slot" "-1" | ||
} | ||
"upgrade" | ||
{ | ||
"attribute" "dmg taken from fire reduced" | ||
"priority" "2" | ||
"slot" "-1" | ||
} | ||
"upgrade" | ||
{ | ||
"attribute" "increased jump height" | ||
"priority" "2" | ||
"slot" "-1" | ||
} | ||
"upgrade" | ||
{ | ||
"attribute" "health regen" | ||
"priority" "3" | ||
"slot" "-1" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#ifndef NAVBOT_TF2_MVM_UPGRADE_H_ | ||
#define NAVBOT_TF2_MVM_UPGRADE_H_ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <unordered_set> | ||
|
||
struct MvMUpgrade_t | ||
{ | ||
MvMUpgrade_t() | ||
{ | ||
index = 0; | ||
attribute.reserve(64); | ||
increment = 0.0f; | ||
cap = 0.0f; | ||
cost = 0; | ||
quality = 0; | ||
max_purchases = 0; | ||
} | ||
|
||
bool operator==(const MvMUpgrade_t& other) const | ||
{ | ||
return this->index == other.index; | ||
} | ||
|
||
bool operator!=(const MvMUpgrade_t& other) const | ||
{ | ||
return this->index != other.index; | ||
} | ||
|
||
// Max amount of purchases possible | ||
void FindMaxPurchases() | ||
{ | ||
if (increment == 0.0f || (increment == cap)) | ||
{ | ||
max_purchases = 1; | ||
return; | ||
} | ||
|
||
int count = 0; | ||
|
||
// increment is positive | ||
if (increment > 0.0f) | ||
{ | ||
for (float base = 1.0f; base < cap; base += increment) | ||
{ | ||
++count; | ||
} | ||
} | ||
else if (increment < 0.0f) // increment is negative | ||
{ | ||
for (float base = 1.0f; base > cap; base += increment) | ||
{ | ||
++count; | ||
} | ||
} | ||
|
||
max_purchases = count; | ||
} | ||
|
||
int index; | ||
std::string attribute; | ||
float increment; | ||
float cap; | ||
int cost; | ||
int quality; | ||
int max_purchases; | ||
}; | ||
|
||
// Used by the bot to reference an upgrade bought | ||
struct TF2BotUpgrade_t | ||
{ | ||
TF2BotUpgrade_t(const MvMUpgrade_t* up) | ||
{ | ||
upgrade = up; | ||
times_bought = 0; | ||
} | ||
|
||
const bool IsMaxed() const { return times_bought >= upgrade->max_purchases; } | ||
|
||
const MvMUpgrade_t* upgrade; | ||
int times_bought; | ||
}; | ||
|
||
// Upgrade Information | ||
struct TF2BotUpgradeInfo_t | ||
{ | ||
TF2BotUpgradeInfo_t() | ||
{ | ||
attribute.reserve(64); | ||
quality = 0; // default | ||
priority = 0; | ||
itemslot = 0; | ||
allowedweapons.reserve(4); | ||
} | ||
|
||
// if allowedweapons is empty, then any weapon is allowed | ||
const bool AnyWeapon() const { return allowedweapons.empty(); } | ||
const bool IsWeaponAllowed(const int itemindex) const | ||
{ | ||
if (AnyWeapon()) | ||
return true; | ||
|
||
return allowedweapons.find(itemindex) != allowedweapons.end(); | ||
} | ||
|
||
std::string attribute; | ||
int quality; | ||
int priority; | ||
int itemslot; | ||
std::unordered_set<int> allowedweapons; | ||
}; | ||
|
||
#endif // !NAVBOT_TF2_MVM_UPGRADE_H_ |
Oops, something went wrong.