Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Advanced level school Python programming. need helps. thanks. Task 3: stat_name_list = Rate', 'CRIT DMG', 'Break Effect', 'Effect RES','Outgoing Healing', 'Energy Regen Rate', 'HPo ',
Advanced level school Python programming. need helps. thanks.
Task 3: stat_name_list = Rate', 'CRIT DMG', 'Break Effect', 'Effect RES','Outgoing Healing', 'Energy Regen Rate', 'HPo ', 'ATK ', 'DEF ] sample input/output str for stats: HP: 1000; ATK: 100;DEF:100; Speed: 100 ;CRIT Rate:5;CRIT DMG:50;Break Effect:0;Effect RES:0;Outgoing Healing:0; Energy Regen Rate:0; HP\% : 0 ; ATK :0; DEF:0 Hint: The following text file contains strings and text which you can simply copy-paste when attempting Task 3 and 4: helper_for_Task3_and_4.txt. Star Road is a game created by the company Mohoyo. It is a turn-based game which allows you to control characters and battle with enemies, in Task 3 and 4, you are to aid the company to create an OOP class and a simple web application related to this game. First, you need to create a class named Stats. The class supposed to store related stats for a character or a relic item, which would enhance the characters' statistics. The class contains 1 private attribute stats of type dictionary. A typical input and output string would look like the following format (as one line): 'HP:1000;ATK:100;DEF:100; Speed:100;CRIT Rate:5;CRIT DMG:50;Break Effect:0;Effect RES:0;Outgoing Healing:0;Energy Regen Rate:0;HP::0;ATK Below is an UML class diagram for your reference. Implement the classes based on the following descriptions: \begin{tabular}{|c|c|} \hline & \begin{tabular}{l} For example, if the stats_str is \\ "HP: 1000; ATK: None; DEF :; Speed: one" \\ Then it should update the key values pairs of HP, ATK and \\ DEF to 1000,0 and 0 respectively and ignore Speed. \end{tabular} \\ \hline + value_list(): list & \begin{tabular}{l} Return a list of stat values based on the stat names stored \\ in the stat_name_list. \end{tabular} \\ \hline++str__(): string & \begin{tabular}{l} String method for the class, to return a string with stat \\ names and values in the following format 'name:value ', \\ separate each stat by using an ' ; ': \\ HP:1000;ATK:0;DEF: None ;... \end{tabular} \\ \hline \begin{tabular}{l} + add_(other:Stats): \\ Stats \end{tabular} & \begin{tabular}{l} Add all the stat values in the current Stats object (self) \\ with another Stats object. Then return a Stats object as \\ the result. \\ If the stat value of one of the object is None, treat it as 0 \\ when adding with the other object's stat value. \\ If the stat values of both of the object are None, let the \\ value of the stat returned be None. \end{tabular} \\ \hline \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started